MASTERING IOS CORE DATA WITH SWIFT
***** Created with Xcode 7.2 and Swift 2.1 *****
Published: January 2016
What is Core Data? Why should I know about Core Data?
Core Data is one of the most powerful framework that Apple has provided for developer. "Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence." - Source from Apple".
If you are passionate about learning mobile development for iOS and looking to take your iOS development skills to the next level, Core Data framework should be at the top of your list.
What's in it for me?
In this course I will take you on a journey in the world of Core Data. We will cover all the important aspects of Core Data:
Throughout this course we will look in detail the Core Data framework to provide data storage functionality in iOS applications. We will start by creating a simple app that is utilizing Core Data framework, building our own Core Data stack and eventually using all different Core Data features into our application.
Perfomance Tuning and Best Practices
We will cover the various ways on fetching our data and how to efficiently using Core Data in our app. Unit testing and performance tuning will be an important part on how we can monitor our app performance in conjunction with Core Data in our application.
Along with Core Data versioning, migration and iCloud integration, I will take you on developing 5 iOS applications and how we can integrate all of these components into Core Data.
Do at your own pace
Lots of students have different methods of learning. Through out this course I will provide both the starter and final Xcode project solution, so you can either follow along one step at a time or you can jump directly to the final solution. And by the end of this Mastering iOS Core Data with Swift course, you should be comfortable and ready to integrate Core Data framework in your application.
Target Audience: All iOS developer that would like to take their skills to the next level.
What are the requirements?
This lecture will outline what will be covered in the Mastering iOS Core Data with Swift course. It will display the goals that students will accomplish by the end of this Core Data course by becoming a more well rounded Swift iOS developer and the readiness to tackle Core Data projects.
This lecture introduces Core Data concept for the first time. It starts by creating a new Core Data project using a Single View Application then it will take users to steps on creating a Grocery List application.
Final solution source codes based on lecture #3.
In this lectures students start creating Entity for the data store. It will introduce the Core Data concept using KVC (key-value coding) approach. By the end of this lecture, students will be able to create Core Data application by storing and retrieving the data using key - value approach.
Final solution source codes based on lecture #5.
This is the first of many major steps in Mastering iOS Core Data with Swift course. In this lecture students will start subclassing the Entities from the data model to create Swift objects to represent the entities. This allows Xcode to provide code completion using dot notation to access our objects instead of using key - value approach.
Final solution source codes based on lecture #7.
This lecture will cover how to extract Core Data stack out of AppDelegate. Students will create a regular Single View Application without checking the option for Core Data during the project creation, and instead will work toward building the Core Data stack manually as a separate Swift file.
Final solution source codes based on lecture #9.
This lecture introduces how to set the Entity and Relationships. It also shows different data types available in Core Data that can be assigned to Attributes, such as String, Integer 16, Double, Binary Data. Students will learn about the concept of one-to-one and one-to-many relationships, how to check the relationships on the entity diagram and learn how Xcode will map the data type from the data model to Swift class.
Final solution source codes based on lecture #11.
In this lecture, we will see how we can capture the data from JSON file and upload the data to the Core Data store.
Final solution source codes based on lecture #13.
In this lecture we will see alternative source of sample data using plist.
In this lecture we will start utilizing the Core Data stack that we build on the previous lecture. We will look into how we can initialize the Core Data and managedObjectContext in the AppDelegate and pass them to the view controllers. This will allow a single instance of Core Data stack distributed for the entire application. This is in preparation of start using Core Data predicate in the part 2 of this Predicate topic.
In this lecture we start diving in building the request object and using predicate to set the search criteria. We will look into the following topic:
Final solution source codes based on lecture #16 and #17.
In this lecture we are introducing Core Data sorting functionality. We will be working on filter and sort functions of the Home Report app and how to update the records in table view using protocol-delegate approach based on the sort and filter options selected by end users.
We are introducing CompoundPredicate to handle multiple criteria when submitting a query to Core Data. We will use CompoundPredicate and SortDescriptor to build the request object.
Final solution source codes based on lecture #19 and #20.
This lecture shows how to utilize Core Data aggregate function "SUM" and "COUNT". It demonstrates the use of DictionaryResultType, CountResultType and CountForFetchRequest. It also shows how to build the expression description into the request object to execute Core Data aggregate functions.
On this second part of Aggregate function lectures, we will look into using Core Data MIN, MAX and AVERAGE aggregate functions.
Final solution source codes based on lecture #22 and #23.
This lecture introduces asynchronous fetching in Core Data using NSAsynchronousFetchRequest and how to handle the response in completion handler.
Final solution source codes based on lecture #25.
This lecture will look into detail how the one to many relationship between entities, translated into code implementation.
Final solution source codes based on lecture #27
In this lecture we will create a new app called My Movie. We will demonstrate how to use NSFetchedResultsController to fetch data from Core Data store. NSFetchedResultsController is created to support tableview in mind so it is a perfect fetching approach when we are using UITableViewController. We will look into more detail why this fetching strategy brings benefit to display and update data in the tableview on the subsequent lectures.
Final solution source codes based on lecture #29.
This lecture demonstrates how to delete a record from our Core Data data store by utilizing NSFetchedResultsController to perform the object deletion. It shows how effectively NSFetchedResultsController handles the update for tableview datasource without the need to manually reload the data.
Final solution source codes based on lecture #31.
We will look into updating multiple records with one batch request. One hidden challenge on this lecture is to update the view after the batch update request is executed. To address this, we will look to fault object and how we can get the object out of it and update the state of the object. We will also learn how to prevent the cache data being used instead of the updated object state.
Final solution source codes based on lecture #33.
This lecture will show how to group and cache the results from Core Data store by leveraging the attributes within NSFetchedResultsController.
Final solution source codes based on lecture #35.
This lecture will introduce us to Xcode Memory Debugging and Core Data Profiler. We will inspect the application memory footprint and how the different approach of Core Data implementation can impact the performance of our application. We will look into how to efficiently deal with large images and how to use thumbnail when necessary will bring performance impact to the application.
Final solution source codes based on lecture #37.
We are going to implement batch size fetching to limit the number of records requested from Core Data store to improve the application performance. It is on demand fetching.
Final solution source codes based on lecture #39.
We are going to implement different fetching strategy to improve our application performance. We will be using unit testing to compare the application performance on before and after tuning up our codes.
Final solution source codes based on lecture #41.
Core Data lightweight migration is the easiest of migrating our data model. We will look at how easy to initiate a lightweight migration as well as versioning our data model.
Final solution source codes based on lecture #43.
This is the first part of manual migration topic. We are going to refactor our data model entities, attributes and relationships. We will create our new mapping model and learn how to manually map the old entities, attributes and relationships to the new data model.
This is the second part of manual migration topic. We are going to update our codes to reflect the new data model that we created on the first part.
Final solution source codes based on lecture #45 and #46.
A walkthrough on how to sign up for Apple Developer Program.
A walkthrough to create an iCloud test account in iTunesConnect.
In this lecture we are going to setup an iCloud sync for our Core Data store. We will look into:
Final solution source codes based on lecture #50.
This is not the end of the road. Set your brand new and shiny skills to work on your next Core Data projects.
Hi! I am Andi. I have a degree in MS Information Systems and been working for a Fortune Top 25 Company for the last few years.
I am passionate about mobile development and have been using both the hybrid and native approach on my projects. I fell in love with Swift and been part of the early adopter. I truly believe Swift will become one of the development languages of the future.
I live in beautiful state of Colorado in the United States and while I am not busy coding, I enjoy biking and skiing.
My motto is never stop learning and share the knowledge. Having said that, I am ready to take you on the journey of Swift development world and hope you will be a part of it.