In this case maybe the documentation for ShouldPerformSegue is slightly vague.
You normally want to override and use ShouldPerformSegue
when you want to say abort a segue that is invoked via the Storyboard.
In the above image's project we got the Button
lead to the VC titled "Second" via a push segue in the Storyboard. Now we could use the ShouldPerformSegue
function in code to control when this segue from the storyboard should actually perform the transition to the "Second" VC by returning true/false from that function.
You'll also probably use the segue identifier at those points to identify the segue that's being handled currently(provided you set an identifier for the segue in the storyboard) if you have multiple segue's from the storyboard for that VC.
In your case you're invoking PerformSegue("nextScreen", this);
from code, so in essence you would know when you should actually invoke it(using your ValidateScreen()
). Thus you can safely ignore the override and just proceed as you initially had.