Daily iOS
iOS system design

Offline chat outbox

In an iOS chat app where the network drops often, messages the user sends must not be lost. How would you design the state transitions of the local outbox?

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

The moment the user taps send, store the message in a SwiftData outbox as pending, move it to sending when transmission starts, sent when the server acks, and failed past the retry limit, and on restart move any sending rows left by a crash back to pending so they go out again.

Share a question