Portrait

I2H3

Notes from work as an app developer for iPhones, iPads and Macs.

RSS Icon GitHub Mastodon

@preconcurrency Imports

This is one of the things I do not find when I am looking for them but only later by accident. When Xcode is reports warning with strict concurrency checks enabled and they are about Apple’s own frameworks, they might be what you are looking for.

Paul Hudson and Avander Lee wrote about it. I do not know how I missed it. I can recall coming across them at a point in the past months when I did not care yet.

a memoji

While working with the file provider framework with strict concurrency checks enabled, I am frequently encountering warnings. I think all types in the framework are not Sendable. That becomes a topic once you dispatch work into a Task which references those non-sendable objects from inside.

Luckily it is possible to annotate module imports with @preconcurrency like this:

@preconcurrency import FileProvider

This suppresses warnings which are not your fault. This cleans up the issue navigator to what you can actually take care of in your project. Meanwhile, Apple hopefully will update their frameworks to support modern concurrency. In any case: Better check those imports once in a while whether the @preconcurrency still is appropriate to not miss out on API changes.

a memoji