Thanks for the clarification.
Does Apple have any documentation/examples for best practices or patterns when working with SwiftData and concurrency?
From the searches and documentation I read, guess I was misled that you should use ModelActors as background interfaces to your models. I’ve seen a lot of examples like the one below:
@ModeActor
actor ItemActor {
func create() async
func fetch()
func importData() async
}
Because of that I’ve created actors like ImportService, ExportService, SearchService, AttachmentService, etc, but now I can’t use them with each other.
I guess this is not how you are supposed to use them. My app has a lot of heavy relationships that are set using asynchronous dependencies, so ModelActors made everything much easier. Originally I was constantly returning object ids then refetching them from context.perform in CoreData, which never seemed right either.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: