Daily iOS
App lifecycle and system

NotificationCenter threads and observers

If you call NotificationCenter.default.post on a background thread, which thread does the observer code run on?

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

Notification delivery is synchronous and the observer runs on the thread that called post (no queue hop). To receive on main, pass queue: .main when you register or hop to the MainActor.

Share a question