This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol AppFlowControlling: FlowControlling { | |
var appFlowController: AppFlowPresenting { get } | |
} | |
protocol AppFlowPresenting: FlowPresenting { | |
func showMainView() | |
} | |
extension AppFlowControlling where Self: UIResponder { | |
var appFlowController: AppFlowPresenting { | |
return flowController() | |
} | |
} | |
extension UIResponder { | |
func flowController<T>() -> T { | |
var current: UIResponder? = self | |
repeat { | |
if let presenter = current as? T { | |
return presenter | |
} | |
current = current?.next | |
} while current != nil | |
fatalError() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment