Daily iOS
Concurrency

Offloading the main thread

A UIKit screen with image conversion and API response handling stutters while scrolling. Which work would you move off the main actor?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Heavy computation that occupies the CPU for a while, like JSON decoding, UIImage resizing, and thumbnail generation, goes off the main actor, and only code that touches the view hierarchy and cell updates stays on main. The rest runs in nonisolated functions, Task.detached, or a separate actor.

Share a question