Context:
- The SwiftUI
@Querymacro has an internalmodelContext. - The
ModelActoralso has amodelContext, from which the data should be read/written.
Issue:
- When writing to
@Modeldata fetched with@Querymacro using aModelActor, it will crash in the most not-obvious ways. - Also, fetching
@ModelwithModelActorwill result in errors in Swift 6 since@Modelaren't sendable.
Problem to Solve:
- How to write a good amount of data to SwiftData/CoreData without blocking the UI thread?
- Would the recommendation from the Apple team be that a large amount of data should be read/written with
ModelActorand a small amount should be done with the@Query's internalmodelContext?