# IOS Performance

> Standards for Instruments, Memory Management, and Optimization. Use when profiling iOS apps with Instruments or optimizing memory and rendering. (triggers: **/*.swift, Instruments, Allocations, Leaks, dequeueReusableCell)

- Skill: `comeonoliver/ios-performance` (Agent Skill)
- Install (CLI): `npx skillmds@latest add comeonoliver/ios-performance`
- Raw SKILL.md: https://api.skillmd.com/api/skills/comeonoliver/ios-performance/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: ComeOnOliver (https://skillmd.com/u/comeonoliver)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/comeonoliver/ios-performance

---


# iOS Performance Standards

## **Priority: P0**

## Implementation Guidelines

### Diagnostic Tools

- **Instruments**: Regularly use **Allocations** and **Leaks** to detect memory issues.
- **Time Profiler**: Identify heavy CPU tasks and Main Thread stalls.
- **Network instrument**: Analyze request payload sizes and frequency.

### Optimization

- **Table/Collection Views**: Always use `dequeueReusableCell` and keep `cellForRowAt` logic lightweight.
- **Image Caching**: Use `SDWebImage` or `Kingfisher` for remote assets to prevent redundant fetching and main-thread decoding. (Note: `AsyncImage` lacks built-in caching; prioritize third-party for lists).
- **Background threads**: Offload expensive work (parsing, encryption) from the Main thread using GCD or Tasks.

### Diagnostics

- **Compiler Warnings**: Enable `SWIFT_TREAT_WARNINGS_AS_ERRORS` in Release builds.
- **Static Analyzer**: Use Xcode's "Analyze" (Product > Analyze) to find logic errors.

## Anti-Patterns

- **No parsing/processing on Main**: Use background thread.
- **No redundant cache clears**: Let system handle low-memory via AppDelegate.
- **No undetected retain cycles**: Use Leaks instrument frequently.

## References

- [Profiling & Optimization](references/implementation.md)


