Dispatch UI updates on the main queue automatically using MainActor
swift5.5.
when using Swift’s new concurrency system : await/async
But what if we’re instead working on a completely custom type that we’d also like to gain the above kind of capability? For example, when implementing an ObservableObject that’s used within a SwiftUI view, we need to make sure to only assign its @Published-marked properties on the main queue, so wouldn’t it be great if we could also leverage the MainActor in those cases as well?
all of this only works when we’re using Swift’s new concurrency system