CtrlK
BlogDocsLog inGet started
Tessl Logo

dpearson2699/swift-ios-skills

Agent skills for iOS, iPadOS, Swift, SwiftUI, and modern Apple framework development.

71

Quality

89%

Does it follow best practices?

Impact

No eval scenarios have been run

SecuritybySnyk

Advisory

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

approachable-concurrency.mdskills/swift-concurrency/references/

Approachable Concurrency Quick Reference

Use this reference when the project has opted into the Swift 6.2 approachable concurrency settings (default MainActor isolation / main-actor-by-default).

Detecting the Mode

Xcode 26: Check build settings under Swift Compiler > Concurrency:

  • Swift language version: 6.2+
  • Default Actor Isolation / Main Actor by Default: enabled
  • Strict Concurrency Checking: Complete / Targeted / Minimal

SwiftPM: Inspect Package.swift swiftSettings for the corresponding flags.

Behavior Changes

Async functions stay on the caller's actor

In Swift 6.2, nonisolated async functions no longer hop to the global concurrent executor. They stay on whichever actor called them. This eliminates many "sending X risks causing data races" errors.

Default MainActor isolation

With SE-0466 enabled, all declarations in the module are implicitly @MainActor. This means:

  • Global and static variables are protected by default.
  • Protocol conformances are implicitly isolated.
  • Mutable state is safe without explicit annotation.

Isolated conformances

Protocol conformances can be explicitly isolated: extension Foo: @MainActor SomeProtocol. The compiler prevents using the conformance outside the matching isolation context.

Applying Fixes in This Mode

  • Prefer minimal annotations. Let default MainActor isolation do the work for UI-bound code.
  • Use isolated conformances instead of nonisolated workarounds for protocol conformances.
  • Keep global/shared mutable state on MainActor unless there is a clear performance need to offload.
  • Remove redundant @MainActor annotations that are now implied by the default isolation mode.

Offloading Work

  • Use @concurrent on async functions that must run on the concurrent pool.
  • Make types or members nonisolated only when they are truly thread-safe and used off the main actor.
  • Continue to respect Sendable boundaries when values cross actors or tasks.

Common Pitfalls

PitfallWhy it happensFix
CPU-heavy work on MainActorDefault isolation hides the problemMove to @concurrent async function
Task.detached breaking isolationIgnores inherited actor contextUse Task { } unless you truly need detachment
Redundant @MainActor everywhereDefault isolation already provides itRemove explicit annotations
nonisolated on mutable stateBreaks the safety guaranteeKeep mutable state isolated

Concurrency Keywords

KeywordWhat it does
asyncFunction can suspend
awaitSuspend here until done
Task { }Start async work, inherits context
Task.detached { }Start async work, no inherited context
Task.immediate { }Start immediately on current actor
@MainActorRuns on main thread
actorType with isolated mutable state
nonisolatedOpts out of actor isolation
SendableSafe to pass between isolation domains
@concurrentAlways run on background thread pool (Swift 6.2+)
async letStart parallel work (fixed count)
TaskGroupDynamic parallel work
sendingParameter-level isolation transfer (SE-0430)

skills

CHANGELOG.md

README.md

tile.json