Core Data Model Attributes and NSManagedObject Property Types Must Match!

Jump to… Data model Attributes and NSManagedObject property types – Match ’em! Optionals are Types Lessons learned Was this article helpful? Please share! Learning Core Data? Watch my course, Core Data Fundamentals with Swift! I admit – it might have taken me less time to figure out my runtime exception if I hadn’t just migrated […]

Creating the Core Data Stack with Backwards Compatibility in Swift

In 2017, we live in a world where there are still non-iOS 10 devices out in the wild. If your app is targeting an iOS version earlier than iOS 10, or macOS Sierra (10.12), you’ll be unable to take advantage of Core Data’s latest “stack creation” class called NSPersistentContainer. So what can you do? While […]

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 […]

Core Data: Solving Ambiguous Type / Redeclaration of Type

I just finished roasting some coffee from Peru. I’ve never had it before, but it got me thinking about my Roaster On the Go “app” as I thought about the context that I could use to show you the solution to the compiler error described in the title. I used this to demonstrate Working with […]

Using a Core Data Model in Swift Playgrounds

Did you know that you can tinker with Core Data inside of Swift playgrounds in Xcode? You can! Jeremiah Jessel, author at, wrote up an article in 2015 detailing how you can use the Core Data framework inside a playground. He shows how you can do everything from setting up the Core Data stack, […]

Sharing a Core Data Model with a Swift Framework

Reviewed on January 28, 2016 – Swift 2.0 Code re-use is a powerful thing, but it’s not always easy to pull off. We strive for it though, because in the long run, it makes maintaining the code far, far easier than if we just settled for copying and pasting. With the introduction of dynamic frameworks […]

Displaying Data With NSFetchedResultsController and Swift

Updated on September 23, 2015 – Swift 2.0 The combination of an NSFetchedResultsController and a UITableView provides a powerful way to integrate Core Data with a user interface. The greatest benefits of using NSFetchedResultsController come when we use it to automatically update a table view when objects are added, updated, or removed from a Core […]

Using Swift to Seed a Core Data Database

Updated on September 23, 2015 – Swift 2.0 Designing an application’s UI can be difficult without actual data to present. Early on in the design process, data sourced from something like an array can suffice. Later on, however, our data sources become more dependent on actual data stores, such as what Core Data provides us. […]

Core Data Cheat Sheet for Swift iOS Developers

Updated on July 27, 2016 – Additional Cheats Having trouble recalling how to perform basic Core Data operations? This cheat sheet is a handy reference to keep you productive with Core Data and Swift! The code snippets below are here to help jog your memory when it’s been a while since you’ve worked in Core […]

Unit Testing Model Layer with Core Data and Swift

Updated on November 19, 2015 – Swift 2.0 As I approached testing my Core Data model, I have to admit I was apprehensive. How in the world was I going to write unit tests for my model layer that depended on a database. Past experience with trying to write tests with databases was painful. I […]