Daily iOS
Architecture

Moving from MVC to MVVM

In an existing UIKit shopping app, the UIViewController handles the API calls, the cache, and the loading UI. When you move from MVC to MVVM, which layer would you put the networking and caching in?

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

Networking and caching go in a Repository layer wrapped in a protocol, not in the ViewModel, and the ViewModel's only job is turning the domain values the Repository returns into loading, success, and failure screen state.

Share a question