Swift Concurrency by Example
About 8 min
Swift Concurrency by Example êŽë š
HACKING WITH SWIFT
Swift Concurrency by Example
Swift Concurrency by Example is the largest free book teaching all aspects of Swift concurrency, walking you through the many and varied ways of running concurrent code in Swift such as async/await, tasks, actors, and more.
Introduction
This stuff is hard | Swift Concurrency by Example
This stuff is hard
How to follow this guide | Swift Concurrency by Example
How to follow this guide
Concurrency vs parallelism | Swift Concurrency by Example
Concurrency vs parallelism
Understanding threads and queues | Swift Concurrency by Example
Understanding threads and queues
Main thread and main queue: whatâs the difference? | Swift Concurrency by Example
Main thread and main queue: whatâs the difference?
Where is Swift concurrency supported? | Swift Concurrency by Example
Where is Swift concurrency supported?
Dedication | Swift Concurrency by Example
Dedication
Async/await
What is a synchronous function? | Swift Concurrency by Example
What is a synchronous function?
What is an asynchronous function? | Swift Concurrency by Example
What is an asynchronous function?
How to create and call an async function | Swift Concurrency by Example
How to create and call an async function
How to call async throwing functions | Swift Concurrency by Example
How to call async throwing functions
What calls the first async function? | Swift Concurrency by Example
What calls the first async function?
Whatâs the performance cost of calling an async function? | Swift Concurrency by Example
Whatâs the performance cost of calling an async function?
How to create and use async properties | Swift Concurrency by Example
How to create and use async properties
How to call an async function using async let | Swift Concurrency by Example
How to call an async function using async let
Whatâs the difference between await and async let? | Swift Concurrency by Example
Whatâs the difference between await and async let?
Why canât we call async functions using async var? | Swift Concurrency by Example
Why canât we call async functions using async var?
How to use continuations to convert completion handlers into async functions | Swift Concurrency by Example
How to use continuations to convert completion handlers into async functions
How to create continuations that can throw errors | Swift Concurrency by Example
How to create continuations that can throw errors
How to store continuations to be resumed later | Swift Concurrency by Example
How to store continuations to be resumed later
How to fix the error âasync call in a function that does not support concurrencyâ | Swift Concurrency by Example
How to fix the error âasync call in a function that does not support concurrencyâ
Sequences and streams
Whatâs the difference between Sequence, AsyncSequence, and AsyncStream? | Swift Concurrency by Example
Whatâs the difference between Sequence, AsyncSequence, and AsyncStream?
How to loop over an AsyncSequence using for await | Swift Concurrency by Example
How to loop over an AsyncSequence using for await
How to manipulate an AsyncSequence using map(), filter(), and more | Swift Concurrency by Example
How to manipulate an AsyncSequence using map(), filter(), and more
How to create a custom AsyncSequence | Swift Concurrency by Example
How to create a custom AsyncSequence
How to convert an AsyncSequence into a Sequence | Swift Concurrency by Example
How to convert an AsyncSequence into a Sequence
Tasks and task groups
What are tasks and task groups? | Swift Concurrency by Example
What are tasks and task groups?
How to create and run a task | Swift Concurrency by Example
How to create and run a task
Whatâs the difference between a task and a detached task? | Swift Concurrency by Example
Whatâs the difference between a task and a detached task?
How to get a Result from a task | Swift Concurrency by Example
How to get a Result from a task
How to control the priority of a task | Swift Concurrency by Example
How to control the priority of a task
Understanding how priority escalation works | Swift Concurrency by Example
Understanding how priority escalation works
How to cancel a Task | Swift Concurrency by Example
How to cancel a Task
How to make a task sleep | Swift Concurrency by Example
How to make a task sleep
How to voluntarily suspend a task | Swift Concurrency by Example
How to voluntarily suspend a task
How to create a task group and add tasks to it | Swift Concurrency by Example
How to create a task group and add tasks to it
How to cancel a task group | Swift Concurrency by Example
How to cancel a task group
How to handle different result types in a task group | Swift Concurrency by Example
How to handle different result types in a task group
Whatâs the difference between async let, tasks, and task groups? | Swift Concurrency by Example
Whatâs the difference between async let, tasks, and task groups?
How to make async command-line tools and scripts | Swift Concurrency by Example
How to make async command-line tools and scripts
How to create and use task local values | Swift Concurrency by Example
How to create and use task local values
How to run tasks using SwiftUIâs task() modifier | Swift Concurrency by Example
How to run tasks using SwiftUIâs task() modifier
Is it efficient to create many tasks? | Swift Concurrency by Example
Is it efficient to create many tasks?
Actors
What is an actor and why does Swift have them? | Swift Concurrency by Example
What is an actor and why does Swift have them?
How to create and use an actor in Swift | Swift Concurrency by Example
How to create and use an actor in Swift
How to make function parameters isolated | Swift Concurrency by Example
How to make function parameters isolated
How to make parts of an actor nonisolated | Swift Concurrency by Example
How to make parts of an actor nonisolated
How to use @MainActor to run code on the main queue | Swift Concurrency by Example
How to use @MainActor to run code on the main queue
Understanding how global actor inference works | Swift Concurrency by Example
Understanding how global actor inference works
What is actor hopping and how can it cause problems? | Swift Concurrency by Example
What is actor hopping and how can it cause problems?
Whatâs the difference between actors, classes, and structs? | Swift Concurrency by Example
Whatâs the difference between actors, classes, and structs?
Important: Do not use an actor for your SwiftUI data models | Swift Concurrency by Example
Important: Do not use an actor for your SwiftUI data models