Exciting times! Introduction to SwiftData was amazing to say the least.
I have been using CoreData for sometime now with SwiftData I wanted look at storage differences. I created two projects from standard templates. One with CoreData and other with SwiftData. Both the projects have one entity with a single property. As far as I can see, both projects look exactly same.
I am using DB Browser for SQLite to open database files. CoreData uses .sqlite extension and SwiftData uses .store
CoreData:
CoreData Database is stored in Applications data folder
$APP_DATA/Library/Application\ Support/$MODEL_NAME.sqlite
Here is screenshot of CoreData database. Nothing fancy, has 4 tables and no indexes, views or triggers.
SwiftData:
SwiftData Database is also stored in Applications data folder
$APP_DATA/Library/Application\ Support/default.store
Here is screenshot of SwiftData database. It has 4 tables like CoreData with exact same structure and more. Few more tables to keep track of transactions and changes. Indexes to speed up look ups.
Tables same as CoreData:
Additional tables:
Indexes:
In next part, I will try to explore functions/usage of tables and indexes of SwiftData.
Leave a comment