Small semantic tweak to variable name

This commit is contained in:
CypherPoet 2019-01-15 22:21:46 -05:00
parent 731dd6f567
commit 6fe2e695d9
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import UIKit
class DetailViewController: UIViewController { class DetailViewController: UIViewController {
@IBOutlet var imageView: UIImageView! @IBOutlet var imageView: UIImageView!
var imagePath: String? var selectedImagePath: String?
override var prefersHomeIndicatorAutoHidden: Bool { override var prefersHomeIndicatorAutoHidden: Bool {
get { get {
@ -23,7 +23,7 @@ class DetailViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
title = imagePath title = selectedImagePath
navigationItem.largeTitleDisplayMode = .never navigationItem.largeTitleDisplayMode = .never
navigationItem.rightBarButtonItem = UIBarButtonItem( navigationItem.rightBarButtonItem = UIBarButtonItem(
@ -32,7 +32,7 @@ class DetailViewController: UIViewController {
action: #selector(shareTapped) action: #selector(shareTapped)
) )
if let _imagePath = imagePath { if let _imagePath = selectedImagePath {
imageView.image = UIImage(named: _imagePath) imageView.image = UIImage(named: _imagePath)
} }
} }

View File

@ -45,7 +45,7 @@ class ViewController: UITableViewController {
if let detailViewController = storyboard?.instantiateViewController(withIdentifier: "Image Detail") as? DetailViewController { if let detailViewController = storyboard?.instantiateViewController(withIdentifier: "Image Detail") as? DetailViewController {
// set the vc's `imagePath` property to match the image selected // set the vc's `imagePath` property to match the image selected
detailViewController.imagePath = imagePaths[indexPath.row] detailViewController.selectedImagePath = imagePaths[indexPath.row]
// push the detail VC onto the navigation controller // push the detail VC onto the navigation controller
navigationController?.pushViewController(detailViewController, animated: true) navigationController?.pushViewController(detailViewController, animated: true)