WatchKit Packaging and WKInterfaceController
Having spent the last few (late) night with Xcode playing with WatchKit apps, there are a few interesting takeaways for any new WatchKit developers:
- Packaging of WatchKit apps is nicely explained by this diagram – target structure. The storyboards are separate from the actual WatchKit code (WKInterfaceController etc). More interestingly, and least well publicised is the fact that Apple Watch also uses wifi if possible, together with the default Bluetooth LE to communicate with its paired iPhone.
- Actions and Outlets work as you’d expect – Control-Drag the UI widget from the storyboard into the Assistant editor page that contains the WKInterfaceController derived code, and the outlet will automatically be created and bound. Essentially creating an IPC channel over Bluetooth to the paired iPhone 🙂
- Shared app group’s are relevant if you want the two processes to access the same files or data (e.g. preference)
- openParentApplication looks like effectively an RPC call between the WatchKit extension sandbox process and the parent iOS process.
- This tutorial offers assistance on adding Glances and Handoff functionality to your WatchKit app.