AceMobileInterview

Interview guides / ios

Janky home feed: iOS Interview Question

Janky home feed interview question with a clear example answer for iOS engineers. Practice with AceMobileInterview.

This is a common iOS interview topic: Janky home feed.

Below is a concise answer you can adapt in a real interview, then go deeper in the full AceMobileInterview track.

  1. 1.Download the buggy Xcode zip. The home feed freezes/stutters on load with a large JSON payload. Find and fix the planted performance issues (≈45–60 min).

    ## Scenario Candidates get a UIKit feed that “works” but freezes on large payloads. ## How to investigate - Reproduce with the bundled large `feed.json` - Time Profiler / Main Thread Checker - Search for `Data(contentsOf` / `JSONDecoder().decode` on the main path ## Planted bug 1: Synchronous network + decode on main **Symptom:** UI freezes ~1s on appear **Root cause:** `FeedViewController.load()` calls `Data(contentsOf:)` and `JSONDecoder` on the main thread **Fix:** `DispatchQueue.global(qos: .userInitiated).async` (or async/await) for load+decode; hop back to main only to assign `items` and `reloadData()` ## Planted bug 2: Image downsample on main **Symptom:** Scroll hitch when cells appear **Root cause:** `UIImage(data:)` + redraw in `cellForRowAt` on main **Fix:** Decode/downsample off-main; cache `UIImage`; cancel work on reuse ## Planted bug 3: Architecture smell **Symptom:** Hard to test / reason about **Root cause:** Networking lives inside the view controller **Fix:** Extract `FeedLoading` protocol + `LocalFeedLoader`; VC only binds results ## Optimization tips - Prefer `URLSession` even for local files when teaching async patterns - Use `autoreleasepool` when decoding many images - Avoid doing I/O inside `cellForRowAt` ## What to say in the interview - How you proved the main-thread hitch before changing code - What you measured after (scroll FPS / time to first content)

Keep going with AceMobileInterview

Reading helps. Timed practice locks it in. Jump into the interactive track for algorithms with LeetCode links, studio projects, debugging zips, and mobile system design.

iOS trackAndroid trackMore guides