 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

A week with the iPad Mini

I have heard nothing but love for the iPad Mini, so I thought I’d take a week and force myself away from my 4th generation iPad. Some context. I love the iPad, but I may not be a typical consumer user. I tend to use it more during the... Continue →