Skip to content

Instantly share code, notes, and snippets.

@CyrilCermak
Last active August 30, 2018 04:42
Show Gist options
  • Save CyrilCermak/88abf20215df62766f8da3a172d13c0c to your computer and use it in GitHub Desktop.
Save CyrilCermak/88abf20215df62766f8da3a172d13c0c to your computer and use it in GitHub Desktop.
/**
Every child flow must implement Flow protocol
- func start: Starts the flow process, it usually decides what is
going to be presented
- var services: Property that contains all the services that are
being used in the app
- var finish: Is a closure that notifies parent Flow
that the child flow is finished.
- var currentVC: Returns view controller that is currently being displayed
*/
public protocol Flow {
init(services: Services, navigationVC: UINavigationController?)
func start()
var services: Services { get }
var finish: (_ flow: Flow) -> () { get set }
var navigation: UINavigationController? { get set }
var currentVC: UIViewController? { get }
}
extension Flow {
public var currentVC: UIViewController? {
return navigation?.viewControllers.last
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment