Where does SwiftData store the data?

I understand by default SwiftData uses SQLite database but it can be configured to persist data in XML, binary and even in-memory databases. Does anybody know where SwiftData the SQLite database is located?

Post not yet marked as solved Up vote post of BigEagle Down vote post of BigEagle
2.3k views

Replies

I found these three files which are part of core-data datastore as well as swiftdata 144 -rw-r--r--@ 1 bsoule staff 73728 Jul 29 10:10 default.store 64 -rw-r--r--@ 1 bsoule staff 32768 Aug 7 14:57 default.store-shm 1160 -rw-r--r--@ 1 bsoule staff 564472 Aug 7 14:56 default.store-wal in my library directory --> Library/Containers/CHCS.ArtManager/Data/Library/Application Support

I expected to also see a file with an sqlite extension but I did not? Any ideas where the sqlite database is stored?

  • The default.store is the SQLite file.

Add a Comment
   guard let appSupportDir = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).last else { return }

all 3 files for the SQL storage is located here at least on iOS

  • Thanks Ryan. However, if using CloudKit, I found the files are not stored in the '...Library/Application Support' directory, but rather in the '...Library/CloudKit/cloudd_db' directory

Add a Comment