When I try to call moveToPage from another class it fails on this line:
let currentIndex = stackPageVC.index(of: currentStackVC)!
with the error:
fatal error: unexpectedly found nil while unwrapping an Optional value
here is my code:
//View controller where the call is started
@IBAction func buttonRightView(_ sender: Any) {
let vc:ViewController = storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
vc.goRight()
}
class ViewController: EZSwipeController {
override func setupView() {
datasource = self
navigationBarShouldNotExist = true
}
func goRight(){
moveToPage(1, animated: true)
}
}
When I try to call moveToPage from another class it fails on this line:
let currentIndex = stackPageVC.index(of: currentStackVC)!with the error:
fatal error: unexpectedly found nil while unwrapping an Optional valuehere is my code: