WatchKit apps are easy to build and draining to debug. I don’t know what it is about extensions but they’re never fun to work with. The other day, daughter asked for an app to play some favorite sounds. I promised I’d write up a post about this, so here it is.
#honk pic.twitter.com/80ha7IHyig
— ericasadun (@ericasadun) May 29, 2020
The entirety of the code took maybe a couple of minutes. This is one of the many places where using SwiftUI is a sheer delight. I did have to play with renderingMode
to override the default B&W scheme for three of my buttons:
I decided to go with bundle-stored audio rather than deal with the complexities of adding audio assets to an xcassets
item. Quick and easy. I limited the daughter to just 4 out of her long list of requested sounds to simplify my life. She returned with her list grudgingly prioritized.
Trimming and converting the audio to wav
took seconds, thanks to command-line ffmpeg. Creating the art, too, was simple. I just used Preview to create all the required App Icons. Call it another 5 minutes to get that done. It was a great time to use Preview’s magic selection wand and its support for layers and transparency.
Where all the trouble lay was getting the watch app to consistent deploy to hardware for testing. Although this was a watch-only app, the phone still plays a big role. And I finally discovered that keeping my phone tethered to the computer when deploying to the watch made for a much smoother and more consistent experience. But the frustrations of failed deploys led to over an hour invested.
Here’s a quick summary of where my development time was spent. Area corresponds to the level of effort:
The actual coding was nothing. Asset prep is always tedious but it’s O(n). It’s pretty clear from the start how much effort is needed, which varies by the number of assets used. You don’t add more complexity when you’re working with the right formats and tools.
The vast majority of headache is getting the Xcode tooling and the hardware to sync, install, and test. This really should be the easiest part, but it was endlessly frustrating. I don’t know if my tether-breakthrough is a universal solution or if my next project will be just as frustrating.
In the end, what should have been a half hour project stretched to several hours. I hope the next one will be way shorter.
One Comment
Finally someone has noticed that too. I’ve been developing a watch app for a half a year and can say that debugging is a nightmare. Xcode often drops the connection, cannot find the watch, attach to it, loading something etc.