Hacker News new | ask | show | jobs
by monocularvision 1334 days ago
It’s really as simple as this:

1. Create a struct (value type in Swift) that implements a protocol (interface) to serve as your ViewModel 2. The main methods to implement are both called “update”. One is called automatically by our infrastructure when Feature state (state that exists across screens) changes. The other is called by the developer in their view controllers to pass along user actions (or other UIKit events). 3. The developer subscribed to all VM changes and updates the view in response. This subscription is done via Combine which is Apple’s FRP framework.

I am planning on writing more about this and the rest of our architecture in the future, hopefully.