I am attempting to make a subclass of UINavigationController that takes additional dependencies. I'd also like to be able to create and specify a root view controller upon initialization. I have this code:
init(rootVC: UIViewController, authUser: AppUser) {
self.authUser = authUser
super.init(rootViewController: rootVC)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
However, upon attempted initialization, I get this error:
Fatal error: Use of unimplemented initializer 'init(nibName:bundle:)' for class
I've looked at other SO answers, in particular this one, which suggests fixing the problem by also overriding the init(nibName:bundle:) method. However, this means I am not able to properly inject the user dependency. How best to address this issue?