title: How to embed UITextView inside UITableViewCell with custom cell that's the delegate?
body: <p>I've got a UITableViewController with two custom cells - one contains a UITextField (for the user to input a title) and the other contains a UITextView (for the user to input a description). Whenever these change, I want to update my memory object (which is a struct with two variables - memoryTitle and memoryDescription).</p>
  
  <p>The memoryTitle seems simple enough - on my ViewController I have the following:</p>
  
  <pre><code> @IBAction func memoryTitleChanged(_ sender: UITextField) {
          memory.memoryTitle = sender.text ?? ""
      }
  </code></pre>
  
  <p>The UITextView has confused me slightly though. There's two issues I'm having - I can't create an action in the same way I can for the UITextField, so my next thought was to make the ViewController the delegate and use textViewDidChange to update memory.memoryDescription but that brings me to my second problem.</p>
  
  <p>In order to make the UITextView cell resize dynamically, I used the following tutorial which works perfectly (<a href="https://medium.com/@georgetsifrikas/embedding-uitextview-inside-uitableviewcell-9a28794daf01" rel="nofollow noreferrer">https://medium.com/@georgetsifrikas/embedding-uitextview-inside-uitableviewcell-9a28794daf01</a>) to make my custom cell this:</p>
  
  <pre><code>class DetailTextTableViewCell: UITableViewCell, UITextViewDelegate {
  
      //Found below method for resizing UITextView and cell - https://medium.com/@georgetsifrikas/embedding-uitextview-inside-uitableviewcell-9a28794daf01
      @IBOutlet weak var memoryDescriptionTextView: UITextView!
      var textChanged: ((String) -&gt; Void)?
  
      override func awakeFromNib() {
          super.awakeFromNib()
          // Initialization code
          memoryDescriptionTextView.delegate = self
          memoryDescriptionTextView.backgroundColor = UIColor.red
      }
  
      override func setSelected(_ selected: Bool, animated: Bool) {
          super.setSelected(selected, animated: animated)
      }
  
      //Found below method for resizing UITextView and cell - https://medium.com/@georgetsifrikas/embedding-uitextview-inside-uitableviewcell-9a28794daf01
      func textChanged(action: @escaping (String) -&gt; Void) {
          self.textChanged = action
      }
  
      func textViewDidChange(_ textView: UITextView) {
          textChanged?(textView.text)
      }
  }
  </code></pre>
  
  <p>Now I'm stuck with DetailTextTableViewCell being the UITextView's delegate, so I'm not sure how to make it update my memory object in the ViewController when the text changes. If anyone has any ideas or guidance it'd be much appreciated!</p>
  
  <p>Thank you in advance.</p>