BlogCode review

My iOS code review checklist

What I look for in a Swift pull request, from state and memory to tests and tone.

Code review is where a team’s standards actually live. A good review catches bugs before users do and spreads knowledge across the team. A bad one is a pile of nitpicks nobody learns from. This is the checklist I use for iOS pull requests, in the order I go through it.

1. Before reading the code

  • Does the description explain why, not just what? It should link the ticket and the design.
  • Is it small enough to review well? Past a few hundred lines, I ask for it to be split.
  • For UI changes, are there screenshots or a short video, in light and dark mode?

2. State and data flow

In SwiftUI, most bugs I find come down to who owns the state:

// Recreated every time the parent redraws
@ObservedObject var model = CatalogViewModel()

// Created once and kept for the view’s lifetime
@StateObject private var model = CatalogViewModel()

Use @StateObject (or @State with @Observable) when the view creates the object, and @ObservedObject when it receives one from outside. I also check that each piece of data has one source of truth, and that UI state changes happen on the main actor.

3. Memory

Retain cycles rarely crash anything. They quietly leak memory and keep work running after a screen is gone. A classic:

// Leaks: the run loop keeps the timer, the timer keeps the closure,
// and the closure keeps self.
timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { _ in
    self.refresh()
}

// Fixed
timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { [weak self] _ in
    self?.refresh()
}

deinit { timer?.invalidate() }

Other usual suspects: closure-based NotificationCenter observers that are never removed, delegates that aren’t weak, and Combine subscriptions that capture self strongly.

4. Concurrency

  • Long-running tasks should check for cancellation, and work tied to a screen should stop when the screen goes away. SwiftUI’s .task modifier handles this for you.
  • UI updates belong on the main actor. Marking a view model @MainActor is usually cleaner than sprinkling DispatchQueue.main.async around.
  • Mutable state shared between tasks should live in an actor or be otherwise protected.

5. Performance

  • No heavy work in SwiftUI’s body or in cellForRowAt. Formatting, sorting, filtering and image decoding belong elsewhere.
  • Images are downsampled to the size they’re shown at, not decoded at full resolution.
  • Lists use stable identifiers, so SwiftUI doesn’t redraw every row.
  • For anything that feels slow, profile with Instruments instead of guessing.

6. Tests

Logic should live where XCTest can reach it, usually in view models and services. I look for tests on the edges: empty states, errors, no network and odd input. For key flows like sign-in or checkout, an XCUITest is worth its upkeep.

7. Accessibility and localisation

  • Text uses Dynamic Type styles, and the layout survives the largest sizes.
  • Icon-only buttons have an accessibility label.
  • No hard-coded user-facing strings. Everything goes through localisation.

8. Release readiness

  • Force unwraps and try! only where a crash really is the right outcome.
  • New permissions have clear usage descriptions in Info.plist.
  • Risky features sit behind a feature flag.
  • Analytics and logs don’t include personal data.

9. How the review reads

Tone matters as much as findings. I explain why something is a problem, suggest code instead of only pointing at it, mark which comments must be fixed and which are optional, and say what’s good. A review should leave the author better at their job, not just their pull request better.

More articles