From f61362258fc9906eec44e8aa3095757f1cb2df45 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Sat, 19 Mar 2022 13:45:03 +1100 Subject: Fix selected item not being passed through --- foray/ForayDetailViewController.swift | 7 ++++--- foray/ForayTableViewController.swift | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/foray/ForayDetailViewController.swift b/foray/ForayDetailViewController.swift index b329774..92abef1 100644 --- a/foray/ForayDetailViewController.swift +++ b/foray/ForayDetailViewController.swift @@ -9,8 +9,6 @@ import UIKit class ForayDetailViewController: UIViewController { - var selectedItem: PenguinItem! - let detailView: ForayNewDetailView = ForayNewDetailView(frame: CGRect.zero) override func viewDidLoad() { @@ -19,11 +17,14 @@ class ForayDetailViewController: UIViewController { self.view.backgroundColor = .systemBackground - detailView.setSelectedItem(selectedItem: selectedItem) self.view.addSubview(detailView) detailView.snp.makeConstraints { (make) in make.edges.equalTo(self.view.snp.margins) } } + + public func setSelectedItem(selectedItem: PenguinItem) { + detailView.setSelectedItem(selectedItem: selectedItem) + } } diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift index b00fca9..c9e055a 100644 --- a/foray/ForayTableViewController.swift +++ b/foray/ForayTableViewController.swift @@ -165,7 +165,7 @@ class ForayTableViewController: UITableViewController { tableView.deselectRow(at: indexPath, animated: true) let item = self.sections[indexPath.section].items[indexPath.row] - detailViewController.selectedItem = item + detailViewController.setSelectedItem(selectedItem: item) self.navigationController?.pushViewController(detailViewController, animated: true) } -- cgit