title: What is a good way to make references between each UIView in the hierarchy?
body: <p>Suppose you have a UIView hierarchy like this</p>
  
  <pre><code>UIViewController
  -&gt;UITableView
  --&gt;UITableViewCell
  ---&gt;UITextView
  </code></pre>
  
  <p>Now when an event happens say</p>
  
  <pre><code>func textViewDidEndEditing(_ textView: UITextView) {}
  </code></pre>
  
  <p>You have a reference to the textView, but lets say you need an UI to change for the entire hierarchy and also data models, how do you do that? </p>
  
  <p>One approach is to give it all the references, but it's very tedious</p>
  
  <pre><code>class CustomTextView {
    init(model: Data, cell: UITableViewCell, tableview: UITableView) {//...}
    func textViewDidEndEditing(_ textView: UITextView) {
       //update model, update cell, update tableview
    }
  }
  </code></pre>
  
  <p>Also I would need to pass similar references to the cell and the tableview. </p>
  
  <p>Another approach is to set the delegate at the controller level. And then you have:</p>
  
  <pre><code>class MyController: UITableViewController {
    func textViewDidEndEditing(_ textView: UITextView) {
      //tableView.updateUI()
      //cell = tableView.cellForRowAtIndexPath...
      //cell.updateUI()
      //cell.textView.updateUI()
      //model.updateData()
    }
  }
  </code></pre>
  
  <p>But then this leads to a massive view controller. </p>
  
  <p>What is the right design pattern here where every view needs access to every other view?</p>