Michael Long
1 min readSep 29, 2019

--

Totally agree that the model should have no dependencies on UIKit.

In fact, I’d take it a step further and say that 9 times out of 10 the ViewModel should have no dependencies on UIKit, and that rare case is when the ViewModel needs to return a custom UIColor or a specific UIImage.

When I discuss ViewModel’s with my team I like to tell them that the ViewModel should be as agnostic to the view presentation as possible. It should be entirely possible to switch out a UITableViewController for a UICollectionViewController with no changes whatsoever needed to the ViewModel.

--

--

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.

No responses yet