I am unable to add init method to the following UIViewController class. I need to write some code in the init method. Do i have to write init(coder) method? Even when I add
Correct flow is, call the designated initializer which in this case is the init with nibName,
init(tap: UITapGestureRecognizer)
{
// Initialise the variables
tap = UITapGestureRecognizer(target: self, action: Selector(("handleTap:")))
// Call the designated init of ViewController
super.init(nibName: nil, bundle: nil)
// Call your viewcontroller custom methods here
setupViewControllers()
}
I used:
convenience init() {
self.init(nibName:nil, bundle:nil)
}
Some people suggested:
convenience init(){
self.init()
}
But this gives you an infinite loop.