iOS Performance
Priority: P0
Implementation Workflow
- Profile with Instruments — Regularly use Allocations and Leaks to detect memory issues. Use Time Profiler for CPU stalls.
- Reuse cells — Always use
dequeueReusableCelland keepcellForRowAtlightweight. - Cache images — Use
SDWebImageorKingfisherfor remote assets.AsyncImagelacks caching for lists. - Offload to background — Move parsing, encryption, and heavy computation off the Main thread using GCD or Tasks.
- Enable strict warnings — Set
SWIFT_TREAT_WARNINGS_AS_ERRORSin Release builds. - Run static analysis — Use Xcode's "Analyze" (Product > Analyze) to catch logic errors.
See background processing and cell reuse examples
Anti-Patterns
- ❌ Parsing/processing on Main thread — offload to background using
Task.detachedor GCD - ❌ Redundant cache clears — let the system handle low-memory via
applicationDidReceiveMemoryWarning - ❌ Undetected retain cycles — use Leaks instrument frequently during development