#concurrency

Found 16 articles tagged with #concurrency

Data Race vs Race Condition in Swift

A data race is when two threads access the same mutable object without synchronization, while a race condition is when the order of events affects the correctness of the program.

May 24, 2023#swift#concurrency

Swift actor `isolated` vs `nonisolated`

Swift actor isolation is a feature of Swift concurrency that allows actors to protect their state from concurrent access by other actors or….

Swift Task Groups

Swift task groups (TaskGroup, ThrowingTaskGroup) are a feature introduced in Swift 5.5 that allow you to create and manage a collection of….

Swift Task.init vs Task.detached

A task can run in the background and communicate with the UI thread when needed. To create and run a task in Swift, you can use initializers Task.init vs Task.detached.

Swift Async/Await

Swift async/await is a new programming model introduced in Swift 5.5 (released on September 20, 2021) for writing asynchronous code that is….

The Problems with Completion Handlers in Swift

Asynchronous programming is an essential part of modern software development, allowing applications to perform long-running tasks without….

A Deep Dive into Swift @MainActor

@MainActor is a global actor that describes the main thread, pretty handy given how often you need to make quick changes that update the user interface.

Swift Sendable protocol and @Sendable attribute

We need a way to differentiate between the cases that are safe to transfer between concurrency domains and those that are not.

Swift Continuations

Asynchronous tasks can suspend themselves on continuations which synchronous code can then capture and invoke to resume the task in response to an event.

Swift Async Sequences

The new AsyncSequence protocol enables a natural, simple syntax for iterating over a sequence of values over time as easy as writing a `for` loop.