1

I have these custom classes :

1.

class MyNavigationController: UINavigationController {

}

2.

class HomeNavigationController: MyNavigationController {

    init() {
        super.init(rootViewController: HomeViewController())
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}

3.

class MyViewController: UIViewController {

}

4.

class HomeViewController: MyViewController {

    init() {
        super.init(nibName: "HomeViewController", bundle: .main)
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

}

Then I try to initialize an instance of HomeNavigationController in app delegate :

let homeVC = HomeNavigationController()

But when doing so, I get this error:

fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'HomeNavigationController'

I don't see why it's trying to call it... so what to do?

Jack
  • 13,571
  • 6
  • 76
  • 98
Rob
  • 4,123
  • 3
  • 33
  • 53
  • 2
    Possibly duplicate https://stackoverflow.com/questions/38028940/mandatory-init-override-in-swift-uinavigationcontroller-subclass – kirander Nov 06 '17 at 11:30
  • 2
    [This will helps you](https://stackoverflow.com/a/45228865/7576100) – Jack Nov 06 '17 at 11:32

0 Answers0