Post

Replies

Boosts

Views

Activity

Reply to Metal addCompletedHandler causes crash with Swift 6 (iOS)
As the Apple Engineer stated and as in the stack overflow reply to the same question https://stackoverflow.com/questions/78999756/metal-addcompletedhandler-causes-crash-with-swift-6-ios not having @Sendable is the cause. The work around (adapting the example built into Xcode: New > Project... > Game > using Metal option): let semaphore = inFlightSemaphore commandBuffer.addCompletedHandler { @Sendable (_ commandBuffer)-> Swift.Void in semaphore.signal() } I am using a different flavour of syntax unless I am told that the above is better practice: commandBuffer.addCompletedHandler { @Sendable [weak inflightSemaphore] commandBuffer in inflightSemaphore?.signal() }
Oct ’24