0

I have made one application in ios using C++ Objective. I have use the sqlite database in application past. Now I will change the whole code in swift language. So I want use the existing sql database use in my app using core data. Please tell me how is it possible? yes then tell me the step and example link.

Kaushal Patel
  • 338
  • 4
  • 19

2 Answers2

2

in short: you cant :)

longer:

you need to keep using sqlite if you wanna keep the db. You can't easily'migrate' a DB from sqlite to cordata. coredata does USE sqlite - true - but it does so in a 'private/proprietary' format that isn't documented and can change over time.

==> stick with sqlite


IF you need to switch, open the old db on the device and write a class to read from sqlite and import to CD.

=> you still need to write a swift sqlite 'reader' class and a core data importer

Community
  • 1
  • 1
Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
0

Core Data uses an ManagedObject model and will use a slightly mangled naming convention in its SQLite-based backing store. You may not be able to use your old SQLite database due to table names being different.

What you may want to do is migrate your old data from your old SQLite db file to your new Core Data SQlite backing data store.

Vito Royeca
  • 657
  • 10
  • 20