Agent skills for iOS, iPadOS, Swift, SwiftUI, and modern Apple framework development.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Advisory
Suggest reviewing before use
Concurrency patterns and best practices specific to SwiftUI applications.
@Observable View ModelsView is @MainActor isolated by default; body and all members inherit
this isolation.@MainActor for all types in a module via default actor
isolation (SE-0466).@MainActor APIs and simplifies UI
code.SwiftUI may evaluate some view logic on background threads for performance:
Shape path generationLayout methods (sizeThatFits, placeSubviews)visualEffect closuresonGeometryChange closuresThese APIs often require Sendable closures to reflect their off-main-thread
runtime semantics.
Accessing @MainActor state from a Sendable closure is unsafe and flagged by
the compiler.
Fix: Capture value copies in the closure capture list.
// WRONG: Captures @MainActor state directly
.visualEffect { content, proxy in
content.offset(y: self.offset) // Error: @MainActor state in Sendable closure
}
// CORRECT: Capture a copy
let currentOffset = offset
// ... use in closure:
.visualEffect { [currentOffset] content, proxy in
content.offset(y: currentOffset)
}Avoid sending self into a Sendable closure just to read a single property.
SwiftUI action callbacks are synchronous so UI updates (like loading states) can be immediate.
struct ContentView: View {
@State private var isLoading = false
@State private var result: String?
var body: some View {
Button("Load") {
isLoading = true // Immediate UI update
Task {
result = await fetchData()
isLoading = false
}
}
}
}Pattern: Use state as the boundary. Async work updates model/state; UI reacts synchronously.
Prefer .task over manual Task creation in views:
.task {
await loadInitialData()
}Advantages:
@MainActor).Task references for cancellation.Use .task(id:) to restart work when a value changes:
.task(id: selectedItem) {
details = await fetchDetails(for: selectedItem)
}@Observable View Models@Observable and @MainActor.@State to own an @Observable instance (replaces @StateObject).@ObservedObject / @StateObject / ObservableObject in new code.@Observable @MainActor
final class ViewModel {
var items: [Item] = []
var isLoading = false
func load() async {
isLoading = true
items = await fetchItems()
isLoading = false
}
}
struct ItemListView: View {
@State private var viewModel = ViewModel()
var body: some View {
List(viewModel.items) { item in
Text(item.name)
}
.task { await viewModel.load() }
}
}Use Observations { } for transactional async observation:
.task {
for await _ in Observations { viewModel.searchText } {
await viewModel.performSearch()
}
}@Observable @MainActor
final class ImageProcessor {
var processedImage: UIImage?
func process(data: Data) async {
// Offload heavy work
let result = await Self.runProcessing(data: data)
processedImage = result
}
@concurrent
nonisolated static func runProcessing(data: Data) async -> UIImage {
// Runs on background thread pool
// ...
}
}Task in body. Use .task modifier instead..task does this automatically; manual Task
references must be cancelled in onDisappear.@concurrent functions.Task.detached in views. Loses actor context. Use Task { } or
.task modifier.@State / @Observable
properties on @MainActor..tessl-plugin
skills
accessorysetupkit
references
activitykit
references
adattributionkit
references
alarmkit
references
app-clips
app-intents
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
references
audioaccessorykit
references
authentication
references
avkit
references
background-processing
references
browserenginekit
references
callkit
references
carplay
references
cloudkit
references
contacts-framework
references
core-bluetooth
references
core-data
core-motion
references
core-nfc
references
coreml
references
cryptokit
references
cryptotokenkit
references
debugging-instruments
device-integrity
references
dockkit
references
energykit
references
eventkit
references
financekit
references
focus-engine
gamekit
references
healthkit
references
homekit
references
ios-accessibility
ios-ettrace-performance
ios-localization
ios-memgraph-analysis
ios-networking
ios-simulator
references
mapkit
metrickit
references
musickit
references
natural-language
references
paperkit
references
passkit
references
pdfkit
references
pencilkit
references
permissionkit
references
photokit
push-notifications
realitykit
references
relevancekit
references
scenekit
references
sensorkit
references
speech-recognition
references
spritekit
references
storekit
swift-api-design-guidelines
swift-architecture
references
swift-charts
references
swift-codable
references
swift-concurrency
swift-formatstyle
references
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-uikit-interop
swiftui-webkit
tabletopkit
references
tipkit
references
vision-framework
weatherkit
references
widgetkit
references