Skip to content

Instantly share code, notes, and snippets.

@martinmroz
Last active November 21, 2018 01:18
Show Gist options
  • Save martinmroz/ff8a2c7f4a0dfa557a8cb9788ed65f38 to your computer and use it in GitHub Desktop.
Save martinmroz/ff8a2c7f4a0dfa557a8cb9788ed65f38 to your computer and use it in GitHub Desktop.
Medium - Flow Controller Demo - Simple Flow
public final class RootFlow {
// MARK: - Private Properties
private let navigationController: UINavigationController
private var presented: Bool = false
// MARK: - Private Properties - View Controllers
private lazy var simpleViewController = SimpleViewController(delegate: self)
// MARK: - Initialization
public init(navigationController: UINavigationController) {
self.navigationController = navigationController
}
// MARK: - Public Methods
public func present(animated: Bool = false) {
precondition(self.presented == false)
self.navigationController.pushViewController(self.simpleViewController, animated: animated)
self.presented = true
}
}
// MARK: - SimpleViewControllerDelegate
extension RootFlow: SimpleViewControllerDelegate {
public func simpleViewControllerAction(_ viewController: SimpleViewController) {
/* Your Action Here: Push, Pop, Present, Dismiss, Make Network Requests */
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment