I am working on an app that uses modern TCA (ReducerProtocol and async code). In one of my action handlers in reducer, I have this:
return .run { send in
let result = await environment.mediaManager.storePhotoOrVideo(
fromItemProvider: itemProvider,
mediaSessionId: mediaSessionId,
configuration: .default
)
await send(.mediaManagerStoredPhoto(result))
}
This is nice and expressive and shows exactly what I want to do. Return type of the environment object function call is Result<URL, MediaManagerError>
. I receive itemProvider
and process it, receiving the result, and pass it on to another action.
Here is the problem. NSItemProvider
is an old type that is not Sendable, and most likely will never be. So I get this warning. Which will be an error further down the road, as Swift keeps strengthening Sendable conformance checking.
Is there a way to use some other API or approach, so that I could keep using non-sendable NSItemProvider
here, without any warnings (future errors)?