Daily iOS
Swift

Protocol-oriented design

A teammate wants to create a BaseViewModel class and have every screen inherit from it. If you proposed a protocol-oriented alternative, how would you design it?

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 the shared behavior into role-based protocols with default implementations in extensions, so each view model adopts only what it needs through composition.

Share a question