Context:
- The SwiftUI
@Query
macro has an internalmodelContext
. - The
ModelActor
also has amodelContext
, from which the data should be read/written.
Issue:
- When writing to
@Model
data fetched with@Query
macro using aModelActor
, it will crash in the most not-obvious ways. - Also, fetching
@Model
withModelActor
will result in errors in Swift 6 since@Model
aren'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
ModelActor
and a small amount should be done with the@Query
's internalmodelContext
?