Version Eighth Edition
Platform iOS 14
Language Swift 5.3
Editor Xcode 12

Learn Core Data with Swift!

This book is for intermediate iOS developers who already know the basics of iOS and Swift development but want to learn how to use Core Data to save data in their apps.

Start with with the basics like setting up your own Core Data Stack all the way to advanced topics like migration, performance, multithreading, and more!

Before You Begin

This section tells you a few things you need to know before you get started, such as what you’ll need for hardware and software, where to find the project files for this book, and more.

i

iii

v

Core Data by Tutorials

Begin your journey of learning core data with the basics like setting up your own Core Data Stack all the way to advanced topics like migration, performance, multithreading and more! By the end of this book, you’ll have hands-on experience with Core Data and will be ready to use it in your own apps.

You’ll click File\New Project and write a Core Data app from scratch! This chapter covers the basics of setting up your data model and then adding and fetching records.

1

NSManagedObject is the base data storage class of your Core Data object graphs. This chapter will teach you how you customize your own managed object subclasses to store and validate data.

2

Under the hood, Core Data is made up of many parts working together. In this chapter, you’ll learn about how these parts fit together, and move away from the starter Xcode template to build your own customizable system.

3

Your apps will fetch data all the time, and Core Data offers many options for getting the data to you efficiently. This chapter covers more advanced fetch requests, predicates, sorting and asynchronous fetching.

4

Table views are at the core of many iOS apps, and Apple wants to make Core Data play nicely with them! In this chapter, you’ll learn how NSFetchedResultsController can save you time and code when your table views are backed by data from Core Data.

5

As you update and enhance your app, its data model will almost certainly need to change. In this chapter, you’ll learn how to create multiple versions of your data model and then migrate your users forward so they can keep their existing data as they upgrade.

6

Testing is an important part of the development process, and you shouldn’t leave Core Data out of those tests! In this chapter, you’ll learn how to set up a separate test environment for Core Data and see examples of how to test your models.

7

No one ever complained that an app was too fast, so it’s important to be vigilant about tracking performance. In this chapter, you’ll learn how to measure your app’s performance with various Xcode tools and then pick up some tips for dealing with slow spots in your code.

8

In this chapter, you’ll expand the usual Core Data stack to include multiple managed object contexts. You’ll learn how this can improve perceived performance and help make your app architecture less monolithic and more compartmentalized.

9

This chapter shows you how to use the new NSPersistentCloudKitContainer to make your Core Data app sync across all the user's devices!

10

Meet the team

Contributors

Who is this book for

This book is for iOS developers who already know the basics of iOS and Swift, and want to learn Core Data.

Concepts covered in this book

  • Create aCore Data App
  • NSManagedObject Subclasses
  • The Core Data Stack
  • Intermediate Fetching
  • NSFetchedResultsController
  • Versioning and Migration
  • Unit Tests
  • Measuring and Boosting Performance
  • Multiple Managed Object Contexts
  • Core Data and CloudKit

Version history

Eighth Edition · iOS 14, Swift 5.3, Xcode 12

v8.0 · Nov 20 2020 · Pietro Rea, Aaron Douglas & Matthew Morey

Seventh Edition · iOS 13, Swift 5.2, Xcode 11

v7.0 · May 19 2020 · Pietro Rea, Aaron Douglas & Matthew Morey
Pro
New

Core Data by Tutorials

By Pietro Rea, Aaron Douglas and Matthew Morey

In this book, you'll master Core Data in iOS using Swift. Comprehensive coverage of Core Data, from beginner to advanced topics.

Read for Free with an Ultimate Pro Subscription* * Includes this and all other books in our online library See all benefits
Buy Individually $59.99 $29.99* *Includes access to all of our online reading features.
See buying options
Hide buying options

All videos. All books.
Now 50% off.

Build your mobile development skills and save! The mobile development world moves quickly — and you don't want to get left behind. Stay ahead of the rest with an Ultimate book & video subscription. Starting at just $149/year for Cyber Monday.