Introduction to Core Data

Data persistency has always been a great deal in iOS apps. The term means that you want to store some data, usually of large amount like images, music, videos, permanently in your app.

There are multiple ways to do this:

  1. Use NSUserDefault
  2. Have a backend to store your data and fetch data when in use like parse.com, or the newly introduced CloudKit from Apple
  3. Use Core Data

NSUserDefault is easy to use but never works in this case since it is a very small-scale “database”, inefficient and low-performance. We usually use this to cache some user settings or preferences in our app but never large data like images or videos.

Having a backend is a great idea but in some situtations, having only your backend then fetching data all the time doesn’t sound very good. What if the user doesn’t have Internet connection? Is it really efficient if you have to fetch the same, large amount of images or videos every time? Here comes Core Data that allows you so save data permanently. It means that if you are building a social app, caching some big data in Core Data is much more efficient!

In this introductory tutorial, we will build a very simple app, but there are still a lot to cover. Core Data is easy to scale yet complicated sometimes to use.

Part 1:

Part 2