Beginning Core Data

Learn the basics of Core Data in this beginner series. You’ll learn how to model your data with attributes and relationships, save data using a context, display saved data in lists and much more, in both SwiftUI and UIKit! By Pasan Premaratne.

4.4 (17) · 1 Review

Download materials
Save for later
Comments
Share

Who is this for?

Beginners with just a little bit of iOS and Swift experience. This course isn’t suited for intermediate or advanced developers. If that’s you, check out our intermediate or advanced video courses for more ways to level-up your developer skills!

Covered concepts

  • Managed object models
  • Managed object contexts
  • Fetch requests and fetch results
  • Sorting data with sort descriptors
  • Filtering data with predicates
  • Using fetched results controllers to handle data changes
  • Storing large files as external data

Part 1: The Core Data Stack

01
Toggle description

What is Core Data? Find out how it is used to store data in your apps.

Toggle description

Take a high level tour of the Core Data stack and understand what Core Data is and isn't.

Toggle description

Understand how Core Data represents an app's data model using managed objects

Toggle description

Core Data needs to keep track of changes to the managed object model and it does this using a managed object context. Get a high level understanding of how a context is used in this episode.

Toggle description

Understand how the persistent store coordinator facilitates communication between the context and underlying data store.

Toggle description

Create a Core Data stack for use in the Reminders app!

Conclusion 1:53
Toggle description

Wrap up this section by reviewing what you've learned about the Core Data stack, and find out what's coming up in the next section.

Part 2: Saving and Fetching Reminders

Toggle description

Learn what an Entity is in the Core Data framework and how you can add attributes to model your data.

In this challenge complete the Reminder entity by adding attributes to define your data model

Toggle description

Understand what managed object subclasses are and how you can use them in code to represent your Core Data model.

Toggle description

Now that you have a Reminder class you can use learn how to populate it and save data to the persistent store.

Toggle description

Understand how to use @FetchRequest and associated types to display the saved Reminders in a list.

Toggle description

Learn how to sort fetched results by adding sort descriptors to your fetch requests.

Toggle description

Learn how to create predicates using NSPredicate to filter fetched results.

Toggle description

Understand how to create relationships between entities in your object graphs to make your data model richer.

Toggle description

Understand how to leverage the relationships in a model to display data without executing a fetch request.

Toggle description

Level up your knowledge of predicates by combining multiple using a compound predicate

Toggle description

In this challenge add functionality to add tags to Reminders by updating the data model.

Toggle description

In the second part of the challenge, update the user interface to display the tags you added in the last challenge!

Toggle description

Understand how to use transient properties to add functionality to your managed objects.

Conclusion 3:10
Toggle description

Wrap up this section by reviewing what you've learned about Core Data and SwiftUI, and find out what's coming up in the next section.

Part 3: Core Data and UIKit

Toggle description

Understand the differences between using Core Data in UIKit versus SwiftUI.

Toggle description

In this episode, configure your project to pass the managed object context around so you can save data.

Toggle description

Understand what a fetched results controller is and how you can use it to fetch lists you have saved.

Toggle description

Learn how to use the fetched results controller's delegate to inform you of changes to the context and handle it appropriately.

Toggle description

In this challenge modernize the view controllers to use diffable data sources in conjunction with fetch results controllers.

Toggle description

Understand the various types of delete rules you can specify when deleting managed object instances.

Toggle description

Now that you understand delete rules let's implement delete methods for the Reminders app.

Toggle description

Understand the difference between Transformable and Binary Data attributes and how you can save large files.

Conclusion 2:36
Toggle description

Wrap up this section by reviewing what you've learned in the course, and find out where to go next!