M-Swift All articles
Swift Concurrency

From Compiler Warnings to Calm Waters: A 2026 Swift 6 Concurrency Migration That Won't Stomp Feature Work

M-Swift
From Compiler Warnings to Calm Waters: A 2026 Swift 6 Concurrency Migration That Won't Stomp Feature Work

Photo: The Next Web from Amsterdam, Netherlands, CC BY-SA 2.0, via Wikimedia Commons

Swift 6 strict concurrency has a reputation problem. It sounds like a tidy weekend cleanup. In reality, it is a slow negotiation with every singleton, delegate callback, and background task in your app. For US iOS teams shipping on a weekly cadence, pausing feature work to chase compiler warnings is a nonstarter. The playbook below is the one that works: keep shipping, turn the concurrency dials gradually, and let CI do the nagging.

Start With a Baseline, Not a Big Bang

Flipping complete concurrency checking on in one branch gives you a warning avalanche. That is useful as a one-time audit, not as a migration plan. Instead, record a baseline: build each module with targeted or complete checking, count warnings, and store the number. Treat those warnings like a budget. A pull request can reduce the count or hold it steady. It cannot add to it. That gives you a ratchet without freezing the roadmap.

Break the work down by module, not by screen. Shared networking, persistence, analytics, and design systems are usually where isolation gets messy. A small utility module with ten warnings is a better first win than a giant feature module with hundreds.

Draw Actor Isolation Boundaries Around the Messy Parts

Most legacy apps do not need an actor for every object. They need clear ownership. Put UI-facing state on the main actor. Keep Core Data work on a dedicated context actor or a serial queue wrapper. Give caches and token stores their own actors. Leave pure value types alone.

The trap is actor explosion. If every service becomes its own actor, you trade data races for a maze of await hops and reentrancy bugs. Start with boundaries that match real contention: UI state, disk access, network session state, and shared caches. Everything else can stay synchronous until the compiler proves it needs isolation.

For UIKit views and view controllers, @MainActor is your friend. For delegate methods that arrive on arbitrary queues, isolate the receiving type and hop explicitly. Do not sprinkle MainActor.assumeIsolated through callbacks just to silence errors. That is how you get a crash that only shows up on a customer's iPhone 12.

Use @preconcurrency Imports as Scaffolding, Not a Forever Home

Legacy frameworks and third-party SDKs often lack Sendable annotations. @preconcurrency import is the escape hatch. Use it for the SDK you cannot patch today, then log the suppression in a migration ticket. Treat each one as debt with an owner and a review date.

The same goes for @unchecked Sendable. It is legitimate for a class that protects mutable state with a lock, but it is not a get-out-of-jail-free card. If you cannot explain the synchronization in one sentence, the annotation is a bug.

Sendable Audits: Find the Values That Cross

Sendable errors are really boundary errors. Audit the types that cross actor boundaries: model objects, closure captures, notification payloads, and completion handlers. Prefer immutable structs with let properties. For reference types, make them final and immutable, or wrap mutable state in an actor. Audit global variables and static caches; those are the usual suspects.

A practical trick is to search for shared mutable state before you search for warnings. Every static var, every shared singleton with a mutable property, and every background closure that captures self is a candidate. Fixing those often clears whole clusters of compiler errors.

Gate It in CI Without Blocking Feature Work

CI should enforce the ratchet, not recreate the avalanche. Run strict concurrency checks per module in pull requests, post the warning count as a comment, and fail only when the number goes up. Keep a nightly full-project strict build so you can see the long tail. Add a dashboard that shows warnings by module and by owner. Visibility beats a giant cleanup epic.

For release branches, keep the gate light. You want hotfixes to move. For main, ratchet hard. This is the same pattern teams use for lint warnings, and it works because it respects the reality of feature delivery.

A Realistic 90-Day Cadence

Weeks one to two: baseline and pick two high-leverage modules. Weeks three to six: fix shared infrastructure and add the CI ratchet. Weeks seven to ten: migrate feature modules behind the gate, one squad at a time. Weeks eleven to twelve: remove @preconcurrency imports you no longer need and document the remaining exceptions.

Do not promise a date for zero warnings. Promise a direction and a budget. In 2026, the teams that finish this migration are not the ones with the biggest cleanup sprint. They are the ones that made the warning count go down every single week while the App Store releases kept going out.

All Articles

Related Articles

Paying for Smarts: The Hidden Cost of On-Device AI in Your Next Swift Release

Paying for Smarts: The Hidden Cost of On-Device AI in Your Next Swift Release