0

As we know if want to work with core data in ios, when we create the project we have to enable core data at the begining.but unfortunately I couldn't do that. but now I want to use core data for my project.so these are my questions.

  • is it possible to add core data now (to work with core data now).
  • if it is possible, how can I do that.
  • how can I check that I have enabled core data when I create the project.

hope your help with this.thank you.

Chanaka Anuradh Caldera
  • 4,280
  • 7
  • 34
  • 61

2 Answers2

0

Yes, you can add core data. Please create a new coredata model. (File>New>File...>iOS>Core Data>Data Model)

Jonas Franz
  • 488
  • 1
  • 8
  • 16
0

You can. The steps needed are:

  1. Added a new Model file. Go to File -> New -> File... -> Core Data -> Data Model, and enter the data model name. It will create a file with extension .xcdatamodeld
  2. Write core data initializers for NSManagedObjectContext, NSManagedObjectModel and NSPersistentStoreCoordinator.

For the second step, I would suggest you create a new test core-data project and copy-paste the Core Data stack code from the test project's AppDelegate to your existing project.

Vinod Vishwanath
  • 5,413
  • 2
  • 24
  • 39