Use enums to define (and inject) your application's state:
enum AppViewState {
case tabs(AppContext)
case modal(AppContext)
case alert(AppContext, title: String, message: String, actions: [UIAlertAction]?)
case unknown
}
Easily transition to a new state:
context.proceed(to: .tabs(context))
A transition is represented as a AppTransition
:
enum AppTransition {
case present(UIViewController)
case set([UIViewController])
}