client-sdk-swift icon indicating copy to clipboard operation
client-sdk-swift copied to clipboard

Support building LiveKit with Complete concurrency checking on

Open dfed opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. I have Complete concurrency checking turned on in my project. When integrating LiveKit, I get the following compile-time warning when referring to AudioManager.shared:

Class property 'shared' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

I can work around this by declaring the following in my code:

extension AudioManager: @unchecked Sendable {
    // AudioManager is indeed Sendable since it utilizing locks under the hood.
}

But it'd be ideal to not need to make this declaration myself.

Describe the solution you'd like Ideally LiveKit target would compile without concurrency warnings with .enableExperimentalFeature("StrictConcurrency"), turned on in Swift 5.10+.

Describe alternatives you've considered Harder option: Get LiveKit compiling in Swift 6 language mode on Xcode 16 Easier option: Embrace the @preconcurrency import and just mark types that are made public and available statically as Sendable or @unchecked Sendable assuming the underlying type is indeed thread-safe.

Additional context Happy to provide some support here – I've gotten a few projects working in Swift 6 language mode already (example) and am familiar with Swift Concurrency's trap doors (and some of the differences between the Swift 5 and Swift 6 concurrency functionality).

This issue is not blocking to adoptees of LiveKit, which is why I've classified this issue as a feature request.

dfed avatar Jul 12 '24 16:07 dfed