Use and Make the core data compatible to iOS 8.0 to current Version

Updated 26 October 2021


Core Data

Some time we need to use core data in application , for that we use in build core data provided by iOS but on the time of creation we select core data and default code attach to appdelegate class and its version is set to current , when we less the iOS version of application then the default code is not supported so we need such code that run from lower version to current version.

For this we need to add some code .

1: On creating a new project select core data.

2: add this code in appdelegate.swift class.

3: Now you can use the any function for insert or delete or update


Here is example for saving the data in core data “Person” is entity name and   “name”,”age” is attribute.

4: Select coredataxml file and click on editor and select create NSMangedsubclass.

5: then it will create a two file.

1: Person + CoreDataClass.swift

So write:

2: Person + CoreDataProperties.swift

write this:

6: for updation or view all .

create a Service.swift class

and write  this:

6: for update write this function:

in your viewcontroller class

7: For viewall data

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home