Junior — Middle
Can you list the main types of data stores used in CoreData?
sobes.tech AI
Answer from AI
CoreData uses the following main types of data stores (Persistent Stores):
- SQLite Store — the most common type, data is stored in an SQLite database, suitable for most applications.
- Binary Store — data is stored in a binary format, used less frequently, usually for small amounts of data.
- In-Memory Store — data is stored only in RAM and not saved to disk, useful for temporary data or testing.
Example of creating an SQLite store:
let container = NSPersistentContainer(name: "ModelName")
container.loadPersistentStores { storeDescription, error in
if let error = error {
fatalError("Unresolved error \(error)")
}
}