Model the domain with types; concur with async/await and isolation. UI: swiftui-development. Persistence: swiftdata. Tests: swift-testing. Server: vapor-swift.
Tooling
- Swift 6 / concurrency checking in new code if the target allows it; respect the app's deployment.
- SwiftPM or Xcode project — preserve the repo's.
swift-format/ SwiftLint if they already exist.
Organization
Sources/MyAppCore/
Models/
Services/
Tests/MyAppCoreTests/
- Modules by boundary (
MyAppCorevsMyAppUI). internaldefault;public/packageonly stable API.- Avoid
*Kitdumping ground.
Language
struct/enumfor values;class/actorwhen there is identity or isolation.enumassociated for closed states.switchexhaustive.letdefault. Explicit mutation (mutating,varlocal).- Domain property wrappers (
@Clamped) only with a clear API. - Generics with real constraints;
some/anyaware (any Errorvs typed). Sendableon data that crosses isolation; not@unchecked Sendablewithout an invariant.
struct UserID: Hashable, Sendable {
var raw: String
}
enum LoadState<Value: Sendable>: Sendable {
case loading
case ready(Value)
case failed(String)
}
Errors
throws/Resultat the edge.LocalizedErrorfor UI.- Do not
try!on input/I/O.fatalErroronly for a programming invariant. - Typed errors (
enum AuthError) in libs; do notNSErrornew.
Concurrency
async/awaitto the edge.Taskwith cancellation (Task.isCancelled/withTaskCancellationHandler).actorfor shared mutable state. UI: IsolationMainActorin view model APIs.- Avoid
DispatchQueueloose in new code ifTasksolves it. - Data races: handle Swift 6 warnings; do not silence with
@preconcurrencybroad. - UI detail:
swiftui-development. Thread-safe persistence:swiftdata.
Interop
- Bridging
NS*only at Objective-C edges. nonisolatedon Sendable types that do not touch UIKit/AppKit.
Anti-patterns
AnyObject+ KVO in new code- Assume
View/ SwiftUI in this skill sharedmutable singleton without an actor- Force unwrap on JSON/network
Task.detachedto “fix” the compiler
Integration with other skills
- SwiftUI:
swiftui-development - macOS:
macos-development - watchOS:
watchos-development - SwiftData:
swiftdata - StoreKit:
storekit - Widgets:
widgetkit - Tests:
swift-testing - MVVM:
mvvm-architecture
Completion criteria
- Clear Sendable types/sealed states
- async with cancellation at the edges
- No
try!/ force unwrap in I/O - Honest isolation (MainActor vs domain actor)
- Tests for the touched core