Daily iOS
Architecture

Data layer for a tabbed app

This is a whiteboard design. You're building a stripped-down Outlook app with only a Messages tab and a Contacts tab. Data read from the API has to show up in both tabs with no lag, and you need to optimize launch time and downloads so contacts appear as early as possible. Design the layers and the data flow.

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 tabs don't call the API themselves; they subscribe to a shared repository (memory cache plus disk cache plus remote) as the single source of truth. When the repository receives new data it updates the cache and emits, so both tabs see the same state.

Share a question