Sample app demonstrating Core Data and WatchKit integration. This simple app is based on Apple's Master/Detail template app with CoreData support. It highlights the changes needed to display the most recent date in the phone list on an Apple Watch App interface. The trickiest parts to completing the demo app lie in sharing access to the Core Data persistent data store and data model.
High Level Steps
- Create a Core Data app using the Master/Detail iOS template
- Add a Watch App Target
- 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
- Update the location of the Persistent Data Store to point to the App Group
- Create a Cocoa Touch Framework for the shared code that accesses the Core Data Store
- Move core data access code into the framework; make classes and methods public
- Build Watch App UI that consumes Core Data via the shared code in the Framework
- Build and run!
If you'd like to watch me create this app in 10 minutes, then check it out here: http://youtu.be/-vR0d7jTuxo