Yeah, what you described points to a SwiftData memory management issue on iOS 18. Thanks for filing the feedback reports. Before the issue is fixed on the framework side, I am trying to explore a workaround. Did you even try the following, or can the following, if working, be an option in your case? Replacing the image data attribute (Item.image) with a relationship, which hopefully avoids loading the whole image when querying items. Using the other way, like fetchCount(_:), to retrieve the count of items. Best, —— Ziqiao Chen Worldwide Developer Relations.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: