Post

Replies

Boosts

Views

Activity

Reply to SwiftData on iOS 18 extreme memory use
I'm working around this bug by only prefetching a light weight property, this way SwiftData will not everything, causing the memory to spike. func countModels() async -> Int { var descriptor = FetchDescriptor<SwiftDataModel>() if #available(iOS 18, *) { descriptor.propertiesToFetch = [\.dateCreated] } let count = try? modelContext.fetchCount(descriptor) return count ?? 0 }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25