Skip Fuse gets #SendingRisksDataRace errors calling async transpiled bridged methods in a Task. (The bridge isn't @MainActor or Sendable.)
/Users/dfabulich/git/skiphack/skipapp-showcase-fuse/Sources/ShowcaseFuse/WebAuthenticationSessionPlayground.swift:89:71: error: sending 'self.webAuthenticationSession' risks causing data races [#SendingRisksDataRace]
87 | let urlWithToken: URL
88 | if #available(iOS 17.4, *) {
89 | urlWithToken = try await webAuthenticationSession.authenticate(
| |- error: sending 'self.webAuthenticationSession' risks causing data races [#SendingRisksDataRace]
| `- note: sending main actor-isolated 'self.webAuthenticationSession' to nonisolated instance method 'authenticate(using:callback:preferredBrowserSession:additionalHeaderFields:)' risks causing data races between nonisolated and main actor-isolated uses
90 | using: URL(string: "https://push.skip.tools/webauth-demo/?scheme=org.appfair.app.showcase")!,
91 | callback: .customScheme("org.appfair.app.showcase"),
/Users/dfabulich/git/skiphack/skipapp-showcase-fuse/Sources/ShowcaseFuse/WebAuthenticationSessionPlayground.swift:96:71: error: sending 'self.webAuthenticationSession' risks causing data races [#SendingRisksDataRace]
94 | )
95 | } else {
96 | urlWithToken = try await webAuthenticationSession.authenticate(
| |- error: sending 'self.webAuthenticationSession' risks causing data races [#SendingRisksDataRace]
| `- note: sending main actor-isolated 'self.webAuthenticationSession' to nonisolated instance method 'authenticate(using:callbackURLScheme:preferredBrowserSession:)' risks causing data races between nonisolated and main actor-isolated uses
97 | using: URL(string: "https://push.skip.tools/webauth-demo/?scheme=org.appfair.app.showcase")!,
98 | callbackURLScheme: "org.appfair.app.showcase",
[#SendingRisksDataRace]: <https://docs.swift.org/compiler/documentation/diagnostics/sending-risks-data-race>
The workaround I used was to add a Sendable extension in an #if SKIP_BRIDGE block.
extension WebAuthenticationSession: @unchecked Sendable {}
… but that adds a warning to the build, "warning: When bridging API from a transpiled module, place all code within a #if !SKIP_BRIDGE condition"
Skip Fuse gets
#SendingRisksDataRaceerrors calling async transpiled bridged methods in aTask. (The bridge isn't@MainActororSendable.)The workaround I used was to add a
Sendableextension in an#if SKIP_BRIDGEblock.… but that adds a warning to the build, "warning: When bridging API from a transpiled module, place all code within a
#if !SKIP_BRIDGEcondition"