O'Reilly logo

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

Core Data in Swift

Book Description

Core Data is intricate, powerful, and necessary. Discover the powerful capabilities integrated into Core Data, and how to use Core Data in your iOS and OS X projects. All examples are current for OS X El Capitan, iOS 9, and the latest release of Core Data. All the code is written in Swift, including numerous examples of how best to integrate Core Data with Apple's newest programming language.

Table of Contents

  1.  Introduction
    1. Is This Book for You?
    2. What Is Core Data?
    3. Online Resources
  2. 1. Before We Begin
    1. Test Application
    2. The Storyboard
    3. The Recipe List
    4. The Recipe Detail
    5. The Edit Workflow
    6. Ready for Core Data
  3. 2. Under the Hood
    1. Introducing the NSManagedObjectModel
    2. Integrating with the NSPersistentStoreCoordinator
    3. Adding the NSManagedObjectContext
    4. Working with NSManagedObject Instances
    5. Building an NSFetchRequest
    6. NSSortDescriptor
    7. Wrapping Up
  4. 3. iOS: NSFetchedResultsController
    1. How to Use the NSFetchedResultsController
    2. Under the Hood of the NSFetchedResultsController
    3. Building Our Own: MSZContextWatcher
    4. Wrapping Up
  5. 4. Versioning and Migration
    1. Some Maintenance Before We Migrate
    2. A Simple Migration
    3. The Difference Between Light and Heavy Migrations
    4. A Heavy/Manual Migration
    5. Fundamentals of Core Data Versioning
    6. Wrapping Up
  6. 5. Performance Tuning
    1. Persistent Store Types
    2. Optimizing Your Data Model
    3. Fetching
    4. Faulting
    5. Access Patterns
    6. Wrapping Up
  7. 6. Threading
    1. Threading and Core Data
    2. Working on the Main Queue
    3. Working off the Main Queue
    4. Interqueue Communication
    5. Parent/Child NSManagedObjectContext Design
    6. Export Operation
    7. Import Operation
    8. Asynchronous Saving
    9. Debug Concurrency Checking
    10. Wrapping Up
  8. 7. Bulk Changes
    1. Running with Scissors
    2. Doing Bulk Updates
    3. Notifying the Application of Changes
    4. Bulk Deletes
    5. Things to Consider When Using the Bulk Change APIs
    6. Wrapping Up
  9. 8. Network Operations
    1. The Problem and the Approach
    2. The Solution
    3. Accessing the Network Operations
    4. Wrapping Up
  10. 9. Using Core Data with iCloud
    1. Introducing the UIManagedDocument
    2. Direct NSManagedObjectContext to iCloud
    3. Consuming Changes from iCloud
    4. Under the Hood
    5. Migrating an Existing Application
    6. Desktop iCloud Integration
    7. Issues with Data Quantities
    8. Sharing Data Between iOS and OS X
    9. Wrapping Up
  11. 10. Adding a Desktop Foundation
    1. Our Application
    2. Our Application Design
    3. Sharing the Data Model
    4. Building the Controller Layer
    5. Building the User Interface
    6. Adding a Splash of Code
    7. Wrapping Up
  12. 11. Bindings, KVC, and KVO
    1. Key Value Coding
    2. Key Value Observing
    3. Cocoa Bindings and Core Data
    4. Other Interface Elements That Use KVO, KVC, and Core Data
    5. Wrapping Up
  13. 12. Spotlight, Quick Look, and Core Data
    1. Integrating with Spotlight
    2. Integrating with Quick Look
    3. Putting It All Together
    4. Wrapping Up