Testing Core Data and SwiftData
How do you set up unit tests for a store layer that depends on Core Data (or SwiftData) so that nothing is left on disk?
How do you set up unit tests for a store layer that depends on Core Data (or SwiftData) so that nothing is left on disk?
Have the store take an NSPersistentContainer or ModelContainer from outside, and in tests inject a memory-only container built with NSInMemoryStoreType, a /dev/null URL, or isStoredInMemoryOnly for SwiftData. Verify migrations separately against a real SQLite file.
PersistenceShort answerIntro
A new iOS project has to store a favorites list, the login session, downloaded PDFs, and…
#core-data #swiftdata
PersistenceShort answerBasics
Which requirements push you to Core Data (or SwiftData) instead of UserDefaults or a…
#core-data #swiftdata
PersistenceMultiple choiceBasics
Select all the correct statements about SwiftData.
#core-data #swiftdata
PersistenceShort answerBasics
A legacy app leans on Realm heavily. As the new hire you're asked whether to stay on…
#core-data #swiftdata