Skip to content

Instantly share code, notes, and snippets.

@volkanbicer
Created April 30, 2019 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volkanbicer/48a931771e3329586bea0e9806a452ee to your computer and use it in GitHub Desktop.
Save volkanbicer/48a931771e3329586bea0e9806a452ee to your computer and use it in GitHub Desktop.
class StoreViewController: UIViewController {
typealias Factory = BooksViewControllerBuilder
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)
}
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