Avatar
Avatar
lovee
@swift-main import SwiftUI class NonSendable { var bool: Bool = .random() } func makeNonSendable() async -> NonSendable { NonSendable() } @MainActor struct Demo { private var bool: Bool? { nonmutating set {} get { nil } } 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() } } }
swiftNightly BOT 2/7/2025 4:10 AM
exit status: 1 with <stdin>:1:8: error: no such module 'SwiftUI' 1 | import SwiftUI | `- error: no such module 'SwiftUI' 2 | 3 | class NonSendable {