title: Swift 4 prepare(for segue:) not being called
body: <p>I have a split view controller and its not calling my prepare(for segue:) method when I click on an item in my table view. Here is my prepare(for segue:) method:</p>
  
  <pre><code>override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          print("Here");
          if segue.identifier == "showPOsDetail" {
              if let indexPath = tableView.indexPathForSelectedRow {
                  let object = objects[indexPath.row] as! NSDate
                  let controller = (segue.destination as! UINavigationController).topViewController as! POsDetail
                  controller.detailItem = object
                  controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
                  controller.navigationItem.leftItemsSupplementBackButton = true
              }
          }
      }
  </code></pre>
  
  <p>And here is a screenshot of my storeyboard. I have no idea why this method is not being called.</p>
  
  <p><a href="https://i.stack.imgur.com/PtVwR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PtVwR.png" alt="enter image description here"></a></p>
  
  <p>Ive been trying to figure with out for days now and I am super duper frustrated that its not working.</p>
  
  <p>Here is my full Master Controller:</p>
  
  <pre><code>import UIKit
  
  class POsMaster: UITableViewController {
  
      var POsDetailController: POsDetail? = nil
      var objects = [Any]()
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          // Do any additional setup after loading the view, typically from a nib.
          navigationItem.leftBarButtonItem = editButtonItem
  
          let addButton = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(insertNewObject(_:)))
          navigationItem.rightBarButtonItem = addButton
          if let split = splitViewController {
              let controllers = split.viewControllers
              POsDetailController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? POsDetail
          }
  
      }
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      @objc
      func insertNewObject(_ sender: Any) {
          objects.insert(NSDate(), at: 0)
          let indexPath = IndexPath(row: 0, section: 0)
          tableView.insertRows(at: [indexPath], with: .automatic)
      }
  
      // MARK: - Segues
  
      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
          print("Here");
          if segue.identifier == "showPOsDetail" {
              if let indexPath = tableView.indexPathForSelectedRow {
                  let object = objects[indexPath.row] as! NSDate
                  let controller = (segue.destination as! UINavigationController).topViewController as! POsDetail
                  controller.detailItem = object
                  controller.navigationItem.leftBarButtonItem = splitViewController?.displayModeButtonItem
                  controller.navigationItem.leftItemsSupplementBackButton = true
              }
          }
      }
  
      // MARK: - Table View
  
      override func numberOfSections(in tableView: UITableView) -&gt; Int {
          return 1
      }
  
      override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return objects.count
      }
  
      override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "POCell", for: indexPath)
  
          let object = objects[indexPath.row] as! NSDate
          cell.textLabel!.text = object.description
          return cell
      }
  
      override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -&gt; Bool {
          // Return false if you do not want the specified item to be editable.
          return true
      }
  
      override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
          if editingStyle == .delete {
              objects.remove(at: indexPath.row)
              tableView.deleteRows(at: [indexPath], with: .fade)
          } else if editingStyle == .insert {
              // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
          }
      }
  
  
  }
  </code></pre>