Excellent article!

I would just add that you can improve the separation of concerns, (without over complicating it):

1. The view model should only know about view concerns, not business/model concerns. For example, use variables like `title`, `detail`, rather than `orderItem`, `itemDescription` and `itemTotal`.

2. You can make an extension of your view model to map particular/different model/business logic into your view model, such as with a convenience init, such as `title: orderItem.description`.

3. The view and view model can then be used to represent numerous business/models. For example, the `OrderDetailsRowView`'s `detail` might be used for an `orderItem.itemDescription` or an `iceCream.flavor.name`.

--

--

Tom Brodhurst-Hill

Tom Brodhurst-Hill

iOS developer and architect for BareFeetWare. Builds apps for enterprise and startups. Runs workshops on building apps like Lego.