Avatar
Avatar
omochimetaru
@swift-5.6.3 import Foundation struct Test { var id: Int var text: String } class Model: @unchecked Sendable { @MainActor var list: [Test] = [ Test(id: 1, text: ""), Test(id: 2, text: "") ] func f() { Task { [self] in await MainActor.run { @MainActor [self] () in self.list[0].text = "updated" } } } } (edited)
exit status: 1 with stderr:<stdin>:17:22: error: actor-isolated property 'list' cannot be passed 'inout' to 'async' function call self.list[0].text = "updated" ^ <stdin>:9:20: note: property declared here @MainActor var list: [Test] = [ ^ (edited)