Open VIewController iOS

0

How do I make the function below (when a navigation bar item is clicked) open another screen already created in Main.storyboard ?

@objc func infoTapped (sender:UIButton) {

}
    
asked by anonymous 06.10.2017 / 19:45

1 answer

4

There are two ways.

One of them is to create a follow in the storyboard, assign it an identifier and in this method call the function performSegue(withIdentifier: IDENTIFICADOR, sender: self) .

The other is you instantiate the VC you want to call in this method, something like this:

if let destinationVC = storyboard?.instantiateViewController(withIdentifier: "IDENTIFICADOR_VC") {
        present(destinationVC, animated: true, completion: nil)
    }
    
06.10.2017 / 21:39