The iPhone App--WatchKit Extension Relationship

I know what you’re thinking. That was a lot of setup for a little “Hello, World!” app. Why so complicated? The reason lies in that WatchKit extension we created. It’s a lot like other extensions on iOS—sharing, activity, photo editing, etc.—in that it’s basically a helper app that lives inside your main app. The WatchKit extension is responsible for all communication between your phone and the watch. This is important because of one simple fact: all of the code you write for your watch app is executed on your iPhone. Every line you write is running on the phone and then updating the UI on the watch. When your code calls setText on the WKInterfaceLabel instance, that UI update travels over the network ...

Get Developing for Apple Watch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.