Given this example, with StateMachine being Sendable,
@Injected(\.applicationStateMachine) var stateMachine
Task {
await stateMachine.processEvent(event)
}
We get compiler errors (oddly only when building for device).
Task-isolated '_stateMachine' is captured by a nonisolated closure. nonisolated uses in closure may race against later nonisolated uses
However, we have found the following does not produce the error:
let stateMachine = Container.shared.applicationStateMachine.resolve()
Given this example, with StateMachine being Sendable,
We get compiler errors (oddly only when building for device).
Task-isolated '_stateMachine' is captured by a nonisolated closure. nonisolated uses in closure may race against later nonisolated usesHowever, we have found the following does not produce the error:
let stateMachine = Container.shared.applicationStateMachine.resolve()