Michael Long
1 min readJan 6, 2020

--

If you need logic to transition from state A to state B, then that logic needs to live somewhere. Placing it into a viewModel lets us run unit/integration tests on that code.

Even this simple example has state for loading the image, processing flags, error handling, etc., and real word apps are usually no where near this simple.

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)