Home > Store > Home & Office Computing > Entertainment/Gaming/Gadgets

Learning Core Data for iOS with Swift: A Hands-On Guide to Building Core Data Applications, 2nd Edition

Register your product to gain access to bonus material or receive a coupon.

Learning Core Data for iOS with Swift: A Hands-On Guide to Building Core Data Applications, 2nd Edition

eBook (Watermarked)

  • Your Price: $31.99
  • List Price: $39.99
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Description

  • Copyright 2016
  • Dimensions: 7" x 9"
  • Pages: 412
  • Edition: 2nd
  • eBook (Watermarked)
  • ISBN-10: 0-13-412003-5
  • ISBN-13: 978-0-13-412003-4

Get Started Fast with Core Data App Development Using iOS 9, Swift, and Xcode 7

 

Core Data is a remarkably mature, stable, and fast platform for data access, and Swift is a world-class language for applying it. Now, there’s a complete guide to using Core Data and Swift together in production apps. Tim Roadley shows you how to gain the benefits of a relational database without writing SQL queries, so you can get more done faster, with less coding.

This book fully reflects Apple’s latest iOS 9 platform innovations and teaches Core Data entirely with Swift examples. It guides you step-by-step through creating a modern data-driven iOS app that fully integrates iCloud via CloudKit for public data sharing.

Roadley introduces up-to-date patterns and best practices designed to overcome the frustrations of Core Data development. Each chapter builds on the last, introducing new topics in the order you’ll implement them and extending your skills simply and intuitively.

Each chapter offers downloadable project code, along with exercises to help you explore even further, either as a self-learner or a student in an iOS development course. Roadley even shows how to build helper classes that simplify reuse of his example code.

If you’re an experienced iOS developer, here are all the Swift skills and resources you need to integrate data into any app—quickly, easily, and painlessly.

Coverage includes

  • Understanding what Core Data is and what it can (and can’t) do
  • Configuring basic managed object models, and choosing data types
  • Expanding data models without introducing errors
  • Using relationships and entity inheritance to unlock more power
  • Delivering memory-efficient, high performance table views
  • Enabling users to easily modify managed object attributes
  • Generating persistent stores of preloaded default data
  • Using Deep Copy to copy objects and relationships between persistent stores
  • Optimizing performance by eliminating bottlenecks and offloading intensive tasks to the background
  • Implementing efficient search
  • Integrating diverse iCloud accounts and preferences
  • Mastering advanced iCloud integration, including entity-level seeding and unique object de-dupe
  • Leveraging public CloudKit databases to sync data across users with different iCloud accounts

About the Website

All code samples are available for download at timroadley.com.

informit.com/learningseries
timroadley.com

Downloads

Downloads

Please download the files associated with Learning Core Data for iOS with Swift here.

Extras

Author's Site

Please visit the author's site here.

Companion Site

Please visit the website associated with Learning Core Data for iOS with Swift at timroadley.com.

Sample Content

Online Sample Chapter

Learning Core Data for iOS with Swift: Managed Object Model Migration

Sample Pages

Download the sample pages (includes Chapter 3)

Table of Contents

Preface     xv
1   Your First Core Data Application     1
What Is Core Data?     1
     Persistent Store Coordinator     2
     Managed Object Model     4
     Managed Object Context     4
When to Use Core Data     5
Introducing the Groceries Application     5
Adding Core Data to an Existing Application     6
     Implementing the Core Data Helper     7
     Adding Paths     10
     Adding the Core Data Stack     10
     Adding the Setup Section     12
     Adding the Saving Section     13
Adding a Managed Object Model File     14
Summary     15
Exercises     15
2   Managed Object Model Basics     17
What Is a Managed Object Model?     17
Entities     18
Attributes     20
Integer 16/32/64     21
Float and Double     22
     Decimal     23
     String     23
     Boolean     23
     Date     23
     Binary Data     23
     Transformable     24
Attribute Settings     25
Subclassing NSManagedObject     27
Scalar Properties for Primitive Data Types     28
Introducing the Demo Function     29
Creating a Managed Object     29
Backend SQL Visibility     31
Fetching Managed Objects     34
     Sorting Fetch Requests     36
     Filtering Fetch Requests     36
     Fetch Request Templates     38
Deleting Managed Objects     41
Summary     41
Exercises     42
3   Managed Object Model Migration     43
Changing a Managed Object Model     43
Adding a Model Version     45
Lightweight Migration     47
Default Migration     50
Migration Manager     54
     Introducing MigrationVC.swift (Migration View Controller Code)     56
     Introducing CDMigration.swift (Core Data Migration Code)     59
Summary     71
Exercises     71
4   Managed Object Model Expansion     73
Relationships     73
Delete Rules     79
     Introducing CDOperation.swift (Core Data Operation)     80
     Delete Rule Testing     83
Entity Inheritance     87
Summary     89
Exercises     89
5   Table Views     91
Table View Basics     91
Core Data Table Views     93
Introducing CDTableViewController     93
     Expanding CDTableViewController     96
     DATASOURCE: UITableView     98
     DELEGATE: NSFetchedResultsController     99
     CDTableViewController Subclasses     101
Enhancing PrepareTVC     105
     Preparing Test Data     107
     Deletion and Cell Selection for PrepareTVC     109
     Interaction for PrepareTVC     110
Introducing ShopTVC     114
     Cell Selection for ShopTVC     116
     INTERACTION for ShopTVC     116
Summary     118
Exercises     119
6   Views     121
View Basics     121
The Target View Hierarchy     122
Introducing ItemVC     123
     Keeping Reference to a Selected Item     123
     Passing a Selected Item to ItemVC     124
     Configuring the Scroll View and Text Fields     125
     Implementing ItemVC     129
     DELEGATE: UITextField     130
     The VIEW Section     131
     Adding Functionality to NSManagedObject Subclasses     133
Units, Home Locations, and Shop Locations     136
     Adding and Editing Units     138
     Implementing UnitsTVC     141
     Implementing UnitVC     143
     Segueing from UnitsTVC to UnitVC     145
     Adding and Editing Home or Shop Locations     146
     Configuring the Home Location Views     147
     Configuring the Shop Location Views     148
Summary     150
Exercises     150
7   Picker Views     151
Picker View Basics     151
Introducing CDPickerTextField     152
Introducing UnitPickerTF     157
     Creating the Unit Picker     159
     Connecting the Unit Picker     160
     Configuring ItemVC for the Unit Picker     161
Introducing LocationAtHomePickerTF     165
Introducing LocationAtShopPickerTF     167
Using the Location Pickers     168
     Connecting the Location Pickers     169
     Configuring ItemVC for the Location Pickers     170
Picker-Avoiding Text Field     173
Summary     176
Exercises     176
8   Preloading Data     177
Including Default Data     177
Indicating Whether an Import Is Required     178
Importing from XML     182
Creating an Import Context     184
Preventing Duplicate Default Data     185
Triggering a Default Data Import     186
Finding or Creating Managed Objects     188
Mapping XML Data to Entity Attributes     192
Importing from a Persistent Store     195
     Using the Default Data Store as the Initial Store     196
Summary     199
Exercises     200
9   Deep Copy     201
The Deep Copy Process     201
Configuring a Source Stack     204
     Configuring the Source Coordinator     204
     Configuring the Source Context     205
     Configuring the Source Store     205
Enhancing CDImporter     206
     Identifying Unique Attributes     207
     Object Info     207
     Copying a Unique Object     208
     Establishing a To-One Relationship     210
     Establishing a To-Many Relationship     211
     Establishing an Ordered To-Many Relationship     212
     Copying Relationships     213
     Deep Copy Entities     215
Triggering a Deep Copy     216
Summary     219
Exercises     219
10   Performance     221
Identifying Performance Issues     221
Implementing the Camera     222
     Implementing the Image Picker Controller Delegates     224
Generating Test Data     228
     Merge Policies     230
Measuring Performance with SQLDebug     232
Measuring Performance with Instruments     233
Improving Performance     236
     Model Optimization     238
     Handling Large Objects     239
Cleaning Up     246
Summary     246
Exercises     247
11   Background Processing     249
Implementing Background Save     249
Configuring an Import Context Parent     253
Faulting Objects     254
Generating Thumbnails     257
Summary     261
Exercises     261
12   Search     265
Updating CDTableViewController     266
Updating PrepareTVC     268
Search Optimization     269
Summary     270
Exercises     270
13   iCloud     271
iCloud Basics     271
Enabling iCloud     273
Updating CDHelper for iCloud     274
     Adding an iCloud Store     275
     Handling iCloud Notifications     277
The Debug Navigator     280
Summary     281
Exercises     282
14   Taming iCloud     283
De-Duplication     283
     Identifying Duplicates     284
     Deleting Duplicates     286
     Triggering De-Duplication     291
Seeding     292
     Preparing Seed Variables     293
     Adding Seed Helper Functions     295
Developing with a Clean Slate     300
Configurations     302
Summary     303
Exercises     303
15   CloudKit Sync: Uploading Objects     307
Introducing CloudKit     307
CloudKit Database Synchronization Limitations     309
Introducing CDCloudSync     309
Public Data Groups     311
Cache Status     316
CloudKit Building Blocks     320
Uploading New Records and Relationships     325
Adding Synchronization Logic     327
Preparing the Managed Object Model for Sync     331
Summary     335
Exercises     335
16   CloudKit Sync: Downloading Changes and Handling Deletions     337
CloudKit Building Blocks (Continued)     337
Change Synchronization     342
Deletion Synchronization     350
Quality Assurance     354
Testing the Network     357
Updating Synchronization Logic     359
Adding CDCloudSync to Your Own Applications     361
Summary     367
Exercises     367
Thank You!     367
A   Preparing the Groceries Application     369
New Xcode Project     369
Storyboard Design     370
App Icons and Launch Images     373
Introducing GenericVC     374
B   Finalizing the Groceries Application     377
New Features     377
Photo Library and Photo Deletion Support     378
Favorites     380
Icon Badge     384
Location De-Duplication Logic     385

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership