Skip to content

Instantly share code, notes, and snippets.

@Gabrimarin
Created January 26, 2020 19:07
Show Gist options
  • Save Gabrimarin/1a4d2c7b577b7ca3cd58259bde996565 to your computer and use it in GitHub Desktop.
Save Gabrimarin/1a4d2c7b577b7ca3cd58259bde996565 to your computer and use it in GitHub Desktop.
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