iOSND News: Core Data Update
iOSND Core Data Course Updated to Swift 4
On behalf of the entire iOS Developer Nanodegree program team, I am excited to announce an all-new version of our Core Data course! Core Data is a fundamental skill for any successful iOS developer, and this course teaches all the best practices and latest features. If you have some experience writing tableview-based applications in Swift, are excited to build apps that create or consume content, and don’t want data management to slow you down, this is the course for you. I know firsthand, because I discovered the merits of Core Data during my own developer journey.
The first time I set out to learn Core Data, I was preparing to attend my first hackathon. It was still a couple of weeks away, but I already knew what app I wanted to build. It would be a visual schedule app to help special needs families manage daily routines. I was excited to build this app because at the time I used a laminated-cardstock-and-velcro tool from an occupational therapist that was a pain to carry around. I dreamed of having the tool as an app in my phone.
As I thought through the skills I would need to build the app — designing the user interface, working with collections — I realized there was a big roadblock in my way. I didn’t know how to save an app’s data. I was pretty sure I’d be able to recruit a teammate to help on the UI side, but I didn’t think I could count on finding someone who knew iOS persistence.
I was going to have to learn it myself.
To be honest, I wasn’t excited about the prospect of working with relational databases. I’d first encountered them in a web programming class years earlier, and the nuts and bolts of managing tables and unique identifiers didn’t exactly capture my fascination.
So it was with trepidation that I sought out resources on Core Data, which I’d heard was Apple’s way of handling persistence. I found the most approachable-looking tutorial I could (this was back in the Objective-C days), and settled in for what I anticipated would be a week of boring backend drudgery.
To my surprise, that week was transformative and energizing. It turned out that Core Data did not require me to interface directly with relational databases at all! I learned that Core Data manages the data layer, allowing developers to interface with the underlying store without having to worry about its implementation details.
I wasn’t going to have to become a database administrator to write my app after all!
Long story short, I went to that hackathon, teamed up with a designer and a UI developer, wrote the data layer and persistence myself, and we won first place. Thank goodness for Core Data!
Ever since then, I’ve been an enthusiastic advocate and teacher of Core Data as an incredibly useful skill to learn for iOS app developers.
So you can imagine how delighted I am to announce that today we launched a completely refreshed version of the Core Data course for the iOS Developer Nanodegree program.
I built this course in collaboration with Udacity iOS Engineer Josh Svatek. Our process was to first rewrite the existing example app’s codebase to use the best practices and most recent features from WWDC, then to build and script the lessons based on that experience.
We also tried to balance the text-heavy nature of most Core Data documentation. One thing that can be confusing at first is using so many classes with similar names: NSManagedObjectContext, NSManagedObjectModel, NSPersistentStoreCoordinator, NSPersistentContainer. We were determined to help differentiate these a bit more readily for beginners, through animations that bring them to life.
We also took care to walk through the practical details of working with Core Data in Xcode. We cover everything from setting up data in the model editor, to adding concurrency debugging to your scheme, through gently-paced screencasts like this one:
Over the four-lesson course, we walk through developing a notes app called Mooskine. It starts out with all the functionality it needs except the ability to save. We begin by converting its model classes to a Core Data layer, and then using Core Data to add persistence. That would be enough for a minimum viable product we could launch in the app store, but we don’t stop there. In the following lessons, we make the UI responsive to data changes, migrate users between data versions when we add a feature that changes the model, and prevent slow data work from freezing the user interface by moving it to the background.
We’re so excited to share this course to help developers who, like ourselves in the past, are excited to build apps, and determined not to let data management stand in their way.
The new course is available now as part of the iOS Developer Nanodegree program, which gives you access to code-reviewed projects, and personalized support and feedback on your progress. You can also see the new Core Data lessons in the free version of the iOS Persistence and Core Data course.