1

I'm new to iOS dev, I'm trying to switch between storyboards.

I followed the answer provided here 'Receiver (<ViewController>) has no segue with identifier 'addSegue'.

I did every step and put the below code in my viewDidLoad, because I want it to automatically go to a new storyboard, depending no a condition. Am I doing something wrong?

self.performSegue(withIdentifier: "identifierName", sender: self)
Sai Grr
  • 23
  • 5

2 Answers2

0

your code is write in prepareForSegue method

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if(segue.identifier == "yourIdentifierInStoryboard")
{
self.performSegue(withIdentifier: "identifierName", sender: self)
}
}
Sagar Bhut
  • 657
  • 6
  • 28
0

Like Vacawama said, it's not possible to do it in the ViewDidLoad, so I've put it in the ViewDidAppear and it works just fine.

Sai Grr
  • 23
  • 5