Skip to content

Instantly share code, notes, and snippets.

@CyrilCermak
Last active August 30, 2018 04:48
Show Gist options
  • Save CyrilCermak/feca51fca7f2dfbb484b0234decee5f4 to your computer and use it in GitHub Desktop.
Save CyrilCermak/feca51fca7f2dfbb484b0234decee5f4 to your computer and use it in GitHub Desktop.
public class CCFeature2Flow: Flow {
public var finish: (Flow) -> () = { _ in }
public var services: Services
public var navigation: UINavigationController?
public required init(services: Services, navigationVC: UINavigationController?) {
self.services = services
self.navigation = navigationVC
}
public func start() {
presentFeature2()
}
private func presentFeature2() {
let vc = MainF2VC(services: self.services)
vc.delegate = self
self.navigation?.pushViewController(vc, animated: true)
}
}
extension CCFeature2Flow: MainF2VCDelegate {
func wantsToGoBack(at vc: MainF2VC) {
finish(self)
}
func wantsToPresent(at vc: MainF2VC) {
let modalVC = ModalFeatureVC(services: self.services)
modalVC.delegate = self
let modalNavigation = UINavigationController(rootViewController: modalVC)
self.navigation?.present(modalNavigation, animated: true,
completion: nil)
}
}
extension CCFeature2Flow: ModalFeatureVCDelegate {
func wantsToClose(at vc: ModalFeatureVC) {
vc.dismiss(animated: true, completion: nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment