Avatar
ジュニア 3/27/2025 2:53 PM
@swift-6.0.3 -swift-version 6 final class NonSendableCounter { var count = 0 nonisolated func increment() async { count += 1 } } @MainActor func foo() async { let counter = NonSendableCounter() await withTaskGroup(of: Void.self) { group in for _ in 0..<10000 { group.addTask { await counter.increment() } } } print(counter.count) } await foo() (edited)