Post

Replies

Boosts

Views

Activity

Reply to iOS 18 SwiftData ModelContext reset
@SplittyDev, your update was was very helpful, thank you! I have two model containers: One for previews with in-memory storage only, and one for development with proper on-disk storage. For that part, here's what I'm doing: extension ModelContainer { static var shared: ModelContainer = { if ProcessInfo.isPreview { return preview } // ... }() static var preview: ModelContainer = { // ... }() } public extension ProcessInfo { static var isPreview: Bool { return ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" } } With your answer and this, I managed to get it all working how I was hoping. :D
Apr ’25