title: Better way of handling xib button press than chained delegates?
body: <p>I have implemented some code including protocols to chain the active instance up to the VC to allow for Segues and am wondering if there's a better way to solve this problem or if I'm handling the Segue the wrong way.</p>
  
  <p>Segues within child classes do not work because they are not in the primary VC</p>
  
  <p>Excerpt from VC file</p>
  
  <pre class="lang-swift prettyprint-override"><code>class ViewController: UIViewController, UITableViewDelegate, TableViewControllerDelegate  {
  
  
      func didButtonPressed() {
          performSegue(withIdentifier: "destStory", sender: self)
      }
  
  
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
  
          tableViewController.delegate = self
      }
  
  
  
  
  }
  </code></pre>
  
  <pre class="lang-swift prettyprint-override"><code>protocol TableViewControllerDelegate {
      func didButtonPressed()
  }
  
  class TableViewController: UITableViewController, TableViewCellDelegate {
      func didButtonPressed() {
          delegate?.didButtonPressed()
      }
  
      let test = ["test1", "test2", "test3"]
      var instanceOf = self
      var delegate: TableViewControllerDelegate?
  </code></pre>
  
  <p>Excerpt from cell file</p>
  
  <pre class="lang-swift prettyprint-override"><code>protocol TableViewCellDelegate {
      func didButtonPressed()
  }
  class TableViewCell: UITableViewCell {
  
      var delegate: TableViewCellDelegate?
      @IBOutlet weak var labelOne: UILabel!
      @IBOutlet weak var labelTwo: UILabel!
      @IBOutlet weak var buttonOne: UIButton!
  
  
      @IBAction func buttonOnePressed(_ sender: Any) {
          delegate?.didButtonPressed()
      }
  </code></pre>
  
  <p>This functions the way I'd expect but seems potentially confusing to work with.</p>