Where View.task gets its main-actor isolation from
['Ole Begemann']
Ole Begemann
If you call .task inside a view’s body property, the async operation will run on the main actor because View.body is (semi-secretly) annotated with @MainActor . import SwiftUI @MainActor func onMainActor () { print ( "on MainActor" ) } struct ContentView : View { var body : some View { VStack { helperView Text ( "in body" ) . Unless the view contains an @ObservedObject or @StateObject property, which makes the entire view @MainActor via this obscure rule for property wrappers whose wrappedValue property is bound to a global actor: A struct or class containing a wrapped instance property with a global actor-qualified wrappedValue infers actor isolation from that property wrapper