After testing the code with the information you provided, I confirmed that modelContext itself must be used within the View. This could be seen through the purple error.
And I found out that @Query doesn't work outside of View because it depends on modelContext even though it isn't specified itself. Do I understand this correctly?
I will check it out and submit a report to the SwiftData team if there is any need as you mentioned.
Thank you for answer :)
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: