Created
April 30, 2019 21:14
-
-
Save volkanbicer/5e72de5110a6dd5c55527c4579101fb7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class StoreViewController: UIViewController { | |
typealias Factory = BooksViewControllerBuilder & VideosViewControllerBuilder | |
private let factory: Factory | |
init(_ factory: Factory) { | |
self.factory = factory | |
super.init(nibName: nil, bundle: nil) | |
} | |
required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Add booksViewController | |
let booksViewController: BooksViewContoller = factory.build() | |
add(child: booksViewController) | |
// Add videosViewController | |
let videosViewController: VideosViewController = factory.build() | |
add(child: videosViewController) | |
} | |
func add(child controller: UIViewController) { | |
//... Add child view contollers | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment