How to subscribe to an actor's publisher?

You may find this article Important: Do not use an actor for your SwiftUI data models helpful.

It states:


SwiftUI updates its user interface on the main actor, which means when we make a class conform to ObservableObject we’re agreeing that all our work will happen on the main actor. As an example, any time we modify an @Published property that must happen on the main actor, otherwise we’ll be asking for changes to be made somewhere that isn’t allowed.

3 Likes