
The article explains how tasks inherit MainActor isolation from the surrounding context, which creates an unexpected suspension point. A task created on the MainActor must wait for the main thread to become available before it even starts executing, even if its first real operation switches to a different isolation domain. This can cause performance issues, especially when many such tasks are created rapidly. The solution is to start the task on a different isolation domain immediately using Task { @concurrent in } and then jump back to MainActor only when UI updates are needed.
The article explains immediate tasks (Task.immediate), a new feature in Swift 6.2 that starts executing synchronously on the caller's executor rather than being scheduled to run later. It covers when to use them (calling async code from synchronous actor code, preserving ordering), the risk of overhang (blocking the caller too long), immediate detached tasks, and immediate child tasks in task groups with addImmediateTask.
Antoine van der Lee
Antoine is an indie developer, founder, and international speaker helping iOS developers level up their skills and careers. As the creator of SwiftLee and co-founder of RNA Ventures (powering RocketSim for teams at Meta, Strava, and Runkeeper), he has built products, communities, and resources trusted by developers worldwide.
Over the past decade, Antoine has:
Through SwiftLee, he shares hands-on articles, resources, and courses that help developers write better code, grow their careers, and go indie. His mission is to empower developers to build not just apps — but sustainable businesses around them.