I overwrote a follow in Swift, do I need to overwrite them all later?

Asked

Viewed 39 times

0

I overwrote a few seconds to use a viewController, where it will be dynamic and receiving the content according to the clicked menu. But the other seconds that I did not put an "identifier" stopped working.

Below is an example of how I am overwriting the following.

 override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        escondeMenu()
        let viewControllerDestino = segue.destination as! CoringaViewController

        if segue.identifier == "mEvento" {
            viewControllerDestino.recebidoEventos = "Eventos"

I’m gonna have to put an ID on all the other seconds that stopped ?

1 answer

1

The method applies to all of the following, what you should do is treat to modify only the following that you want. You did not specify what "stopped working" would be, in which case it could be a crash where the target controller is not a CoringaViewController, what can be solved so:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    escondeMenu()

    if segue.identifier == "mEvento", let viewControllerDestino = segue.destination as? CoringaViewController {
        viewControllerDestino.recebidoEventos = "Eventos"
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.