O'Reilly logo

Developing for Apple Watch by Jeff Kelley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing Tasks in Your iPhone App

The most common situation you’ll run into in WatchKit where you need to involve the parent app is performing a task that you can’t perform on the watch. Perhaps you need to make a network connection; perform computationally intensive image rendering that would take much longer than the watch app will be active; or access a system framework that’s unavailable from WatchKit, such as HealthKit. WKInterfaceController has a class method built exactly for these needs: openParentApplication(_:reply:). Pass in a Dictionary and a closure to be executed when the task is done, and your iPhone app takes over. Let’s implement this in the TapALap app to save workout data to HealthKit.

Joe asks:
Why Can’t We Save This in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required