Performance Profiler
Checklist
View Redraws
- Views only redraw when dependencies change
- @State properly scoped
- Stable view identity (no random IDs)
Lists
- Use
ListnotScrollView + VStackfor large data - Stable
IdentifiableIDs - Lightweight row views
Memory
- No retain cycles (
[weak self]in closures) - @StateObject for owned objects
- Image caching for remote images
Body Computation
- No heavy work in view body
- Pre-compute expensive operations
Quick Wins
| Issue | Fix |
|---|---|
| Parent redraws | Extract stable child views |
| Expensive body | Pre-compute or cache |
| Unstable IDs | Use UUID in Identifiable |
| Retain cycle | [weak self] |
| Broad animation | Scope to specific views |
Debug
let _ = Self._printChanges() // In view body
Severity
- 🔴 Critical: Visible lag, leaks
- 🟡 Moderate: Noticeable impact
- 🟢 Minor: Optimization opportunity