Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MiniCursoIFSPSwiftSegue
// MARK: - Navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "HomeToDetailSegue" {
if let vc = segue.destination as? DetailViewController {
vc.delegate = self
if let animal = sender as? Animal {
vc.selectedAnimal = animal
}
}
}
}
// MARK: - Table View
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let animal = self.animalsArray[indexPath.row]
//view segue
self.performSegue(withIdentifier: "HomeToDetailSegue", sender: animal)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.