Tag Archives: Swift Prramming

Core Data in Swift Tutorial (Part 1)

Core Data in Swift Tutorial (Part 1)

This post compatible with Xcode 6 GM

Core Data is the de facto standard way to persist and manage data in both iPhone and Mac applications. So it’s only natural that we should take some time to learn about it when building apps.

The first thing to know about Core Data before diving in is that it is not a relational database, and although it uses SQLite as a backing engine, is not an ORM to a relational database either. The SQLite backend is more of an implementation detail, and in fact binary files or plists can be used instead.

The official Apple documentation describes Core Data like this:

“The Core Data framework provides generalized and automated solutions to common tasks associated with object life-cycle and object graph management, including persistence.”

Before we get too technical about what Core Data is, I think it’s useful to dive in and start playing with the API a bit.

Create a new Xcode 6 project using a single-view template, Swift as the language, and with Core Data enabled. I’ll call the project MyLog.