18 lines
510 B
Swift
18 lines
510 B
Swift
import Foundation
|
|
import SwiftData
|
|
|
|
public enum ModelContainerFactory {
|
|
public static func makeSchema() -> Schema {
|
|
Schema([Bookmark.self, Label.self])
|
|
}
|
|
|
|
public static func makeContainer(inMemory: Bool = false) throws -> ModelContainer {
|
|
let schema = makeSchema()
|
|
let configuration = ModelConfiguration(
|
|
schema: schema,
|
|
isStoredInMemoryOnly: inMemory
|
|
)
|
|
return try ModelContainer(for: schema, configurations: [configuration])
|
|
}
|
|
}
|