I have a segue that I mapped from one screen to the next. The first screen always goes to the second page. But I want to make sure that the segue only goes to the second page if some code executed (for example validation checks were ok). Is that possible to set up?
Thanks!
Personally, I’d suggest making sure that that button is disabled until the fields have been changed in such a way that they pass the validation rules. Thus, as those fields change, perform the validation, enabling the segue button once they satisfy the validation rules.
If your validation is complex (e.g. requires some server round trip), then remove the segue from the button, hook your button up to an
IBOutletwhich validates, and upon success, transitions/segues to the next scene.