From 5fbe87e25c1136e29494d181edbdbf6d6dbba6e1 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Wed, 16 Mar 2022 10:15:27 +1100 Subject: Add a detail view Resources: - https://guides.codepath.com/ios/Using-UITableView (was a bit dated) --- foray/ForayTableViewController.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'foray/ForayTableViewController.swift') diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift index a5c367a..fd4854e 100644 --- a/foray/ForayTableViewController.swift +++ b/foray/ForayTableViewController.swift @@ -142,4 +142,14 @@ class ForayTableViewController: UITableViewController { dateFormatter.dateFormat = "yyyy" return "Released in " + dateFormatter.string(from: section.year) } + + // MARK: - Navigation + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + let indexPath = tableView.indexPathForSelectedRow! + let item = self.sections[indexPath.section].items[indexPath.row] + + let dvc = segue.destination as! ForayDetailViewController + dvc.selectedItem = item + } } -- cgit