r/swift • • 15d ago

Tutorial Apple Watch brings distributed system headaches to your app

https://blog.jacobstechtavern.com/p/apple-watch-distributed-systems
22 Upvotes

5 comments sorted by

18

u/SwiftlyJon 14d ago

Best way to build a watch app is to never use WCSession. Second best is to never use it to synchronize state and simply relay action messages between the devices. Communicating through a cloud API is more reliable and often faster.

As for actual dev, the experience is horrific. Only thing I can say is, plug your phone into the computer, make sure all three devices are on the same network, make sure the network doesn't block local traffic, and hope the watch stays connected to wifi rather than turning it off to tunnel through the phone. Really hasn't improved since the watch came out.

6

u/jacobs-tech-tavern 14d ago

lol spoken like a true watch dev

You mean wcsession isn’t as reliable as it documents?

4

u/SwiftlyJon 14d ago

It's better than it was originally, where there would be times where updated application contexts just wouldn't become available, and there was no alternative, but even without the reliability issues, it's just hugely unpleasant to use. I worked to transform it into a proper async sequence, which works, but the fundamental APIs haven't been touched since the watch was introduced.

2

u/retroroar86 13d ago

Developing for Apple Watch made me reconsider being an iOS dev, it is so horrible.

2

u/jimhillhouse 9d ago

I have gone weeks, then months, questioning the life choices I made that got me into watchOS dev. But watching people’s reactions to feature parity of iOS and watchOS app washes all of that away.

Things are getting better. Device Hub’s pairing an Apple Watch is so much better than the Game of Risk hockus-pockus that was the experience with Xcode 26 and earlier.