CoreData Tutorial Part 5/5 - Model Versioning, Lightweight Migration, Model Mapping

When you need to change your Core Data Entities or structure, you have to add new model version before you send your App in AppStore. If you change just attributes or fetched templates, it’s not needed, you can do it without consequence. But if you want to add a new Entity, you have to migrate your persistent store to a new model version. You should also set mappings for the migration. In this tutorial, we add model versions, model mappings, and using Lightweight Migration.

Read more

SyncKit tutorial - CloudKit with CoreData IOS10, Obj-C

This Tutorial shows you SyncKit, a great Solution for syncing your data using CloudKit between devices instead of iCloud Drive with Core Data, because of Core Data stores with ubiquity options have been deprecated. I’m going to create a simple model, where companies have departments and employees are in departments. I’ll import at launch CoreDataDefaults, exactly 5 Companies. After that I’m going to add new departments and employees too. With a Sync button, I will sync these Data with CloudKit.
Because of I import companies at first launch, if the user deletes the app, and later install it again, these will duplicate. Avoid this, I’m going to use QSPrimaryKey identifying objects, so if the Name of the Company already exists, that will be not synced again, that will be not duplicate neither in CloudKit nor local.

Read more

“You must to know!” Collection - Core Data simple explanations

 With Core Data framework you can manage your objects in your App. You can manage your object’s life-cycle and object graph, so the attributes and relationships of your entities. You can edit, save modify and rebuild your database. You can group, filtering, organizing your data. I try to explain just the basics with this example.

Read more

Core Data tutorial part 4.2 / 5 - Using NSFetchedResultsController, Reorder TableViewCells with LongPressGesture

In this Core Data Tutorial, we do very important and useful things: First we set NSFetchedResultsController, and do changes in the code, create displayOrder attribute.With LongPressGestureRecognizer we can reorder TableViewCells and update Core Data cells with displayOrder attribute, which saved immediately in Core Data.

Read more