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

Learning Core Data for iOS: A Hands-On Guide to Building Core Data Applications

Book Description

Get Started Fast with iOS 7 Core Data App Development
Covers iOS 7 and Xcode 5

This is the first Core Data book to fully reflect Apple’s latest platform innovations, including its dramatic¿ recent improvements to iCloud support. Hands-on from start to finish, it teaches you step-by-step as you create a modern data-driven iOS app using Storyboards, ARC, iOS 7, and Xcode 5.

Tim Roadley introduces new patterns and best practices designed to overcome the frustrations of Core Data development. One step at a time, you’ll build and extend your skills--even mastering advanced techniques such as complex model migration, deep copy, background processing, and integration with Dropbox, StackMob, and iCloud.

Downloadable versions of this book’s main project are provided with each chapter, so you can see exactly what your app project should look like--and get cookbook-style code for your own projects. Chapter exercises help you explore even further, whether you’re a self-learner or a student in an iOS development course.

If you’re an experienced iOS developer, this guide brings together all the skills, tools, code, and patterns you need to add powerful data management capabilities to any app--quickly, easily, and painlessly.

Coverage includes the following:

  • Understanding Core Data

  • Adding Core Data to an existing project

  • Designing, upgrading, and migrating data models (automatically and manually with progress indication)

  • Populating views with data, including table-views and picker-views

  • Preloading a “default data” persistent store from XML

  • Deep-copying from one persistent store to another

  • Performance tuning with Instruments, using large photos as the example

  • Background processing, using thumbnail generation as the example

  • Efficient search

  • Seamlessly backing up and restoring with Dropbox

  • Stable integration with iCloud--with full support for multiple accounts, seeding, and de-duplication

  • Web service integration with StackMob

  • Table of Contents

    1. Contents
    2. Part I: Building Your Application
      1. 1. Your First Core Data Application
        1. What Is Core Data?
        2. When to Use Core Data
        3. Introducing Grocery Dude
        4. Adding Core Data to an Existing Application
        5. Summary
        6. Exercises
      2. 2. Managed Object Model Basics
        1. What Is a Managed Object Model?
        2. Adding a Managed Object Model
        3. Entities
        4. Attributes
        5. Integer 16/32/64
        6. Float/Double
        7. Attribute Settings
        8. Subclassing NSManagedObject
        9. Scalar Properties for Primitive Data Types
        10. Snippet Demo Method
        11. Creating a Managed Object
        12. Back-End SQL Visibility
        13. Fetching Managed Objects
        14. Deleting Managed Objects
        15. Summary
        16. Exercises
      3. 3. Managed Object Model Migration
        1. Changing a Managed Object Model
        2. Adding a Model Version
        3. Lightweight Migration
        4. Default Migration
        5. Migration Manager
        6. Summary
        7. Exercises
      4. 4. Managed Object Model Expansion
        1. Relationships
        2. Delete Rules
        3. Validation Errors
        4. Entity Inheritance
        5. Summary
        6. Exercises
      5. 5. Table Views
        1. Table Views 101
        2. Core Data Table Views
        3. Introducing CoreDataTVC
        4. AppDelegate’s CoreDataHelper Instance
        5. Introducing ItemsTVC
        6. Introducing ShopTVC
        7. Summary
        8. Exercises
      6. 6. Views
        2. The Target View Hierarchy
        3. Introducing ItemVC
        4. Units, Home Locations & Shop Locations
        5. Summary
        6. Exercises
      7. 7. Picker Views
        1. Picker Views
        2. Introducing CoreDataPickerTF
        3. Introducing PickerTF_Unit
        4. Introducing PickerTF_LocationAtHome
        5. Introducing PickerTF_LocationAtShop
        6. Picker Avoiding Text-Field
        7. Summary
        8. Exercises
      8. 8. Pre-loading Data
        1. Default Data
        2. Is An Import Required?
        3. Importing From XML
        4. Creating an Import Context
        5. Preventing Duplicate Default Data
        6. Triggering a Default Data Import
        7. Introducing CoreDataImporter
        8. Mapping XML Data to Entity Attributes
        9. Importing from a Persistent Store
        10. Summary
        11. Exercises
    3. Part II: Advanced Topics
      1. 9. Deep Copy
        1. Deep Copy
        2. Configuring a Source Stack
        3. Enhancing CoreDataImporter
        4. Triggering a Deep Copy
        5. Summary
        6. Exercises
      2. 10. Advanced Table Views [This content is currently in development.]
      3. 11. Background Processing
        1. Background Save
        2. Background Processing
        3. Introducing Faulter
        4. Introducing Thumbnailer
        5. Summary
        6. Exercises
      4. 12. Search
        1. Search
        2. Summary
        3. Exercises
      5. 13. Backup & Restore with Dropbox
        1. Overview
        2. Dropbox Integration
        3. Preparing CoreDataHelper
        4. Building DropboxHelper
        5. Building DataTVC
        6. Summary
        7. Exercises
      6. 14. iCloud
        1. Overview
        2. Enabling iCloud
        3. Introducing iCloudHelper
        4. Disabling iCloud
        5. iCloud Integration
        6. Summary
        7. Exercises
      7. 15. Taming iCloud
        1. De-Duplication
        2. Seeding
        3. Core Data Reset
        4. iCloud Account & Preference Changes
        5. Configurations
        6. Dropbox Restore
        7. Summary
        8. Exercises
    4. A. Preparing Grocery Dude for Part I
      1. New Xcode Project
      2. Storyboard Design
      3. Icons
    5. B. Preparing ‘Grocery Pal’ for Part II [This content is currently in development.]
    6. C. Finalizing ‘Grocery Pal’ [This content is currently in development.]