swift-performance-optimization-skilllisted
Install: claude install-skill fal3/claude-skills-collection
# Swift Performance Optimization Skill
Optimize from evidence. Preserve behavior, accessibility, data correctness, and lifecycle safety while changing performance characteristics.
## Baseline
The copy-ready examples use Xcode 16, Swift 6 language mode with strict concurrency, and iOS 17. Most principles apply to older targets; verify each API against the app's actual minimum. Material from the OS 27 development cycle is beta relative to stable Xcode 26.6 and requires an explicit request, beta labeling, stable fallback, and availability gate.
## Measurement workflow
1. Define a user-visible symptom and a reproducible scenario.
2. Record device, OS, build configuration, dataset, thermal state, and network conditions.
3. Measure an optimized Release build on representative hardware. Simulator-only timing is not release evidence.
4. Select the instrument that answers the hypothesis.
5. Save a baseline trace or metric, change one variable, then repeat the same scenario.
6. Confirm that the bottleneck moved and no memory, energy, correctness, or accessibility regression appeared.
7. Add a regression threshold where the workload is stable enough to automate.
Useful tools include:
| Symptom | First evidence source |
|---|---|
| CPU-bound work | Time Profiler; inspect heavy stacks and self time |
| SwiftUI update cost | SwiftUI instrument plus Time Profiler |
| Scroll or animation stalls | Animation Hitches, Core Animation, signposts |
| Growth or leaks | Allocations, Leaks, Me