Avatar
Avatar
koher
そうすると、 @MainActor で escape できるのがおかしい? @swift-5.6.3 func run(_ operation: () -> Void) { operation() } func runEscaping(_ operation: @escaping () -> Void) { operation() } actor Foo { var count: Int = 0 func countUp() { run { count += 1 } runEscaping { [weak self] in guard let self = self else { return } print(self.count) } } }
exit status: 1 with stderr:<stdin>:18:24: error: actor-isolated property 'count' can not be referenced from a non-isolated context print(self.count) ^ <stdin>:10:9: note: property declared here var count: Int = 0 ^