Created
January 21, 2019 17:04
-
-
Save sagaya/9a90adc015a7de29e7a968c82523e74e to your computer and use it in GitHub Desktop.
generic_controller
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
class BaseController<ViewType: UIView>: UIViewController, Controller { | |
var viewType: ViewType{ | |
if let view = self.view as? ViewType { | |
return view | |
} else { | |
let view = ViewType() | |
self.view = view | |
return view | |
} | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.view = ViewType() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment