 Watch App and Core Data

This post will be a little more technical than most on this site. I wanted to explore how to create a Watch App which shares data with its companion Phone App via Core Data. Though this seems reasonably straight forward to achieve, I didn’t see a lot of info on the developer forums. Furthermore, there were a few tricks to getting it to work that I felt were worth sharing.

Below, I cover Core Data integration with a Watch App at a high level and in the linked video and Github repository I cover the approach in full detail. I put this together in an evening, so design may be a little basic, but should provide a good jumping off point.

High Level Steps #

  1. Create a Core Data app using the Master/Detail iOS template
  2. Add a Watch App Target
  3. Add a shared App Group container in the Capabilities area of the project. Add the same container for each of the following:
    • iPhone App
    • WatchKit Extension
  4. Update the location of the Persistent Data Store to point to the App Group
  5. Create a Cocoa Touch Framework for the shared code that accesses the Core Data Store
  6. Move core data access code into the framework; make classes and methods public
  7. Build Watch App UI that consumes Core Data via the shared code in the Framework
  8. Build and run!

Video Walkthrough #

If you’d like to watch me create this app in 10 minutes, then check it out here.

 
147
Kudos
 
147
Kudos

Now read this

Another damn iPhone app?!

There are over a million of these things, we know. And yeah, 70% of them are list apps of one type or another. So why did we endeavour to build yet another iPhone list app? We wanted to learn. iOS 7 Only. We wanted to see what we could... Continue →