Relative Content

Tag Archive for swiftconcurrencyactorswift-concurrencyswift6

Swift 6: Capture of ‘self’ with non-sendable type in a @Sendable closure

Context Consider this simple example, where we have an Actor and a Class which holds a reference to that Actor: actor MyActor { func doWork() -> Int { return 42 } } class MyClass { let worker: MyActor = MyActor() func swift6IsJustGreat() { Task { let number: Int = await worker.doWork() // ERROR: Capture of […]