Agent skills for iOS, iPadOS, Swift, SwiftUI, and modern Apple framework development.
71
89%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Advisory
Suggest reviewing before use
Context: WWDC23 session on building a mental model for SwiftUI performance and triaging hangs, hitches, and excessive update work.
SwiftUI performance starts with one rule: only work that is required for the current state should happen for the current frame.
A slow screen usually means one of these is false:
The session's practical loop is:
Do not skip the last step. SwiftUI optimizations are easy to misjudge by eye.
A view updates when one of its dependencies changes.
Common dependency sources:
@State@Binding@Observable / @ObservedObject@EnvironmentForEach, List, Table)The performance goal is not "fewer dependencies" in the abstract. The goal is precise dependencies so only the view that needs to update actually updates.
Self._printChanges() is useful in debug builds when you are not sure why a
view keeps updating.
Use it to answer:
Do not treat _printChanges() output as a shipping-time profiling tool.
View bodies need to stay cheap.
Typical mistakes:
bodybodybody// DON'T
var body: some View {
List(items.filter(shouldShow).sorted(by: sortRule)) { item in
Text(numberFormatter.string(from: item.value as NSNumber) ?? "")
}
}
// DO
var body: some View {
List(viewModel.visibleItems) { item in
Text(item.formattedValue)
}
}The winning pattern is precomputation at the model boundary, not clever work in
body.
Identity is one of the biggest hidden performance levers in SwiftUI.
Use stable IDs that survive refreshes and sorting. If identity churns, SwiftUI cannot reuse rows, preserve animations, or diff efficiently.
Inside ForEach, SwiftUI expects a predictable mapping between data elements and
rendered views.
Avoid patterns like:
ForEach(items) { item in
if item.isVisible {
Row(item: item)
}
}Prefer:
ForEach(visibleItems) { item in
Row(item: item)
}AnyView in hot list rowsType erasure can hide useful structural information and increase work in large lists or tables.
TableRow resolves to a single row. Keep row structure predictable and use the
streamlined Table APIs when possible.
Keep view initialization lightweight. Start async work with .task or from a
model object.
// DON'T
struct DetailView: View {
let loader = BigLoader() // heavy construction
}
// DO
struct DetailView: View {
@State private var model: DetailModel?
var body: some View {
content
.task {
model = await loadDetailModel()
}
}
}A computed property can still be body work if it runs during render. If it is expensive, treat it like body work and precompute it.
Use Instruments for hangs, hitches, update counts, and expensive frames.
_printChanges()Use it in debug to inspect dependency behavior.
A debug build can make SwiftUI performance look worse or different than a shipping build. Validate important performance changes in Release on device.
If one small piece of state changes frequently, isolate the subview that reads it.
Do filtering, mapping, sorting, and grouping before rendering.
Environment is convenient but not free. Keep fast-changing values local unless multiple subtrees truly need them.
Move formatters, bundle lookups, and derived strings out of repeated body paths.
After optimizing, check all of the following:
A performance fix that breaks state ownership or animation correctness is not a real fix.
skills
accessorysetupkit
references
activitykit
references
adattributionkit
references
alarmkit
references
app-clips
app-intents
references
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-localization
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
spritekit
references
storekit
swift-api-design-guidelines
swift-architecture
swift-charts
references
swift-codable
swift-concurrency
swift-formatstyle
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