Enum is probably one of the most powerful feature of
Swift. It's simple, yet it allow to easily build complex
Finite State Machine. Let's explore how to extract View Controller's state dependant logic into enum and how to test it separatly.
View Controller often take different state depending of some specific state of the App (fetching data, user logged in/off, ...). This can lead to some internal test condition which clutter your code and are also hard to test. Wrapping up this logic into an enum with associated values allow to split this UI logic piece from the rest of the View Controller logic.