Created
January 2, 2021 19:48
-
-
Save adevone/994d5cd5a5cb11f6789dbe3732bb6b25 to your computer and use it in GitHub Desktop.
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 BaseViewController: UIViewController { | |
private var controller: ViewModelController! | |
func setViewModel(_ controller: ViewModelController) { | |
controller.setViewProviderUnsafe(viewProvider: { [weak self] in | |
return self | |
}) | |
self.controller = controller | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
if controller == nil { | |
fatalError("\(String(describing: self)) call setViewModel before super.viewDidLoad") | |
} | |
controller.viewCreated() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment