what is @concurrent?

Asked on 06/16/2025

3 searches

The @concurrent attribute in Swift is used to ensure that a function always runs on the concurrent thread pool. This allows the actor to run other tasks simultaneously, improving performance by offloading work to the background. This attribute is part of Swift's concurrency model, which aims to make concurrent code easier to write and safer by identifying potential data races at compile time. The use of @concurrent is particularly beneficial for tasks that are CPU-intensive and should not block the main actor or any other actor.

For more details, you can refer to the session What’s new in Swift (34:57).