Slide 32
Slide 32 text
extension UIViewController {
func present(viewControllerType: DI.Type, dependency: DI.Dependency,
withNavigationType navigationType: UINavigationController.Type? = nil, animated: Bool = true,
completion: (() -> Swift.Void)? = nil) where DI: UIViewController {
let vc = viewControllerType.make(withDependency: dependency)
if let navigationType = navigationType {
let nav = navigationType.init(rootViewController: vc)
present(nav, animated: animated, completion: completion)
} else {
present(vc, animated: animated, completion: completion)
}
}
func push(viewControllerType: DI.Type, dependency: DI.Dependency,
animated: Bool = true) where DI: UIViewController {
let vc = viewControllerType.make(withDependency: dependency)
navigationController?.pushViewController(vc, animated: animated)
}
}
%FQFOEFODZ*OKFDUBCMFΛͬͯભҠ࣌ͷίʔυΛநԽ