Avatar
@swift-main // import SwiftUI class NonSendable { var bool: Bool = .random() } func makeNonSendable() async -> NonSendable { NonSendable() } struct Demo: View { @State private var bool: Bool? nonisolated func foo() async { let ns = await makeNonSendable() Task { @MainActor in bool = ns.bool } } var body: some View { Text("Hello, World!") // .task { // NG // let ns = await makeNonSendable() // bool = ns.bool // } .task { // OK await foo() } } }