Core Data Fundamentals with Swift

Core Data is an extremely powerful framework for managing and persisting data on your users’ devices. And let’s face it: saving data to your users’ devices is inevitable. The question is, which data management and persistence technology you use when the time comes for you to tackle this challenge?

I’ve been hard at work on a new course for Pluralsight called “Core Data Fundamentals with Swift“, and the best news is that it’s now LIVE in the Pluralsight library!

The course will give you the essential skills you need to architect an app to use Core Data.

Course Trailer

You can check out a trailer of the course over at Pluralsight completely free.

Topics

1 – Getting Started with Core Data

Module 1 is the introduction to the course with discussion of the motivating factors for using Core Data, course prerequisites, storyline overview, and a demo of the end product of the course.

I had a blast making the demo app. Essentially, I put you in the scenario where we team up to build a prototype of an app that our Human Resources department has come to us with. They came to us with an idea – Over the past year or two, they’ve noticed that employee morale is down a bit. To improve the situation, they’re implementing a new Employee Recognition program. As part of the new program, they’ve come to our internal software development team to see if it might be possible to build some kind of an app that allows employees to recognize one another for jobs well-done – electronic “Shout Outs” if you will.

And that’s where you and I come in – HR wants us to prototype something up so that they have an idea of what’s possible.

Throughout the course, we work on this prototype app together!

2 -Setting up the Core Data Stack

Working with Core Data begins with setting up the Core Data Stack. You will learn how to implement the stack, how to architect your app for testability and maintenance, and how to share Core Data components (such as NSManagedObjectContext) between view controllers.

3 – Creating a Data Model

Building a data model is the foundation for persisting information with Core Data. You will learn to create a data model in Xcode, and you will understand how to work with that model in Swift code.

4 – Building Relationships Between Entities

Understanding the importance of relationships and how to build them is vital to the efficiency and expressiveness of your Core Data model. You will learn why building relationships is worth the investment, and then you will gain the skills you need to be able to build these strategic links between Entities in Xcode.

5 – Saving, Accessing, and Deleting Data

Having the ability to save data to a Core Data persistent store is essential. Being able to retrieve that data later on for display, for modification, or even for removal from the persistent store is also a critical. You will learn the mechanics of how to use the Core Data framework classes that are involved with saving, accessing, and deleting data in this module.

6 – Showing and Synchronizing Data with NSFetchedResultsController

Displaying data in a user interface and keeping it synchronized with the state of the persistent store is a critical piece of the Core Data puzzle. You will learn how to use NSFetchedResultsController for keeping table views in sync. You will also examine using the iOS Notification Center as an alternative way to detect and respond to changes in the persistent store.

7 – Changing Core Data Models

It’s inevitable: You’re going to have to change your data model from its original form sooner or later. This module will guide you in creating new versions of your data model. You will also learn how to migrate your persistent store to new data model versions so that no data is lost as you make changes.

8 – Understanding Core Data Changes in iOS 10 and macOS Sierra

Change is constant. Be prepared for the latest enhancements to the Core Data framework by understanding what’s new in Core Data with Apple’s latest platforms. You will learn about a new framework class called NSPersistentContainer that is designed to simplify the Core Data stack creation process. This concluding module will also point you to resources that will help you build on your new Core Data foundation.

Course Resources

Demos of technology in action are super important to me. That being the case, I tried to pack as much demo content into the course as possible. You’ll get to see the full array of dev-time experiences, not just the final “it works perfectly” outcomes.

The course also comes complete with working Xcode projects that gradually build you up to the final version of the app, one step at a time through each module.

Feedback Welcome!

I welcome feedback on this course, and on other iOS development courses you might be interested in seeing in the Pluralsight library. Happy learning!

  • Congrats Andrew, CoreData needs all the training help it can get 🙂

    • Andrew Bancroft

      Thanks so much, Peter! It was an absolute joy to create the course – I had a lot of fun with it, and I hope it ends up being helpful to folks who have access to Pluralsight’s library!

      • I am probably going to resubscribe soon, this course would be #1 on my list and should be for others as well.

  • Bionik6

    Hey Andrew, Thank you very much for your course. I really enjoy watching it and applying the concepts right away in my app which was using Realm.

    I have some suggestions though. The last 4 lessons of Module 6 (Showing and Synchronizing Data with NSFetchResultsController), when you update the data with the NSFetchedResultsControllerDelegate, you could just use tableView.reloadRows(at: [indexPathToUpdate], with: .automatic) which does the exact same thing you do with the NotificationCenter or setting the properties of the cell.
    This method is not referenced in the Apple documentation for a reason I don’t know, you have to dive deeper in the source code in order to find it. However they’ve talk about it here: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/TableView_iPhone/ManageInsertDeleteRow/ManageInsertDeleteRow.html#//apple_ref/doc/uid/TP40007451-CH10-SW9

    Thank you again for this excellent course, it’s definitely the reference when learning Core Data.

    Best Regards 🙂

    https://uploads.disquscdn.com/images/289c8e891478852d983154ca6a405a6cb3a073d8ff372e630885b9f2e6c85920.png

    • Andrew Bancroft

      Very, very awesome! Thanks so much for stopping by and giving feedback. I love how you show an alternative way to implement the .update case of the NSFetchedResultsController delegate method.

      The fact that you mentioned Realm has me really curious – Are you migrating your app from Realm to Core Data? I’d love to hear the story behind that, and/or just hear how you’re using both in your app. Feel free to leave more comments, or shoot me an e-mail at andrew[at]andrewcbancroft.com.

      Have a good one, my friend – Thanks for watching the course!