Core data updating

Posted by / 23-Dec-2017 20:54

Core data updating

Once you have declared what entities you wish to update, you need to specify what changes need to be made: dictionary can have one or more key/value pairs so that multiple changes can be performed during one execution.

These changes cannot be calculated or dynamic in any way; that is, they cannot contain any logic beyond the filtering that is available in the predicate.

It took me couple of hours to find all the resourses and make it working.

Therefore I am writing this tutorial now so that you can find in one place what I found scattered all over the internet. Simple solution would be to just select Core Data while creating Xcode project. Call it in the context of you app's data model. Now you're all set lets get to Core Data magic.2.

Xcode will add all the necessary code your App Delegate file and it will also create .xcdatamodeld file for you. Defining your data model Open your .xcdatamodeld file and create an Entity and define its attributes. finished: Bool, task Description: String and uuid: String etc. UIColor or another Type that is not listed simple choose Transformable and than once you gonna use it for an UI element just retrieve it Create NSManaged Object Subclass. Now that we have defined our entity all we want to do is to use it! Saving data What I like to do and I think is well known good practice is to put all methods that are based on my Entity in one class and than just use it in view controllers.

Save some data to it, retrieve it, update it, delete it… In this case I have a class called Tasks and everything happens there.

It is important to use it as a singleton and not to create multiple instances of it.

core data updating-27core data updating-37core data updating-49

( Some conventions in IGList Kit like NSObject is diffable by default?

One thought on “core data updating”