Created
January 26, 2020 19:07
-
-
Save Gabrimarin/1a4d2c7b577b7ca3cd58259bde996565 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EstanteViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
@IBOutlet weak var tableView: UITableView! | |
var listaDeObjetos: [Objeto] = [] | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
guard let destinoViewController = segue.destination as? DestinoViewController, | |
let indice = self.tableView.indexPathForSelectedRow?.row | |
else { | |
// Entrará aqui se a classe de destino for nula | |
// portanto, trate este erro como achar melhor. | |
return | |
} | |
destinoViewController.dado = listaDeObjetos[indice] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment