Daily iOS
Concurrency

Real-time pipeline

You're building an app that applies real-time filters to the camera preview. It has to hold 60fps while staying memory safe (no buffer leaks, no contention). What thread and queue structure would you design for the capture, process, render pipeline?

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

Split it into three stages: a dedicated serial queue for capture, a dedicated serial queue (or GPU command queue) for processing, and rendering tied to CADisplayLink/Metal vsync. Reuse pixel buffers from a pool and keep reference lifetimes short; GCD and Metal queues give more predictable latency than Swift Concurrency.

Share a question