Skip to content

Instantly share code, notes, and snippets.

@jamestapping
Created April 2, 2021 14:49
Show Gist options
  • Save jamestapping/9d3077a1f7b3fc4b27f5f83d647e5bba to your computer and use it in GitHub Desktop.
Save jamestapping/9d3077a1f7b3fc4b27f5f83d647e5bba to your computer and use it in GitHub Desktop.
Medium TableView TextView example - TextViewCell.swift
import UIKit
protocol TextViewCellDelegate {
func updateCellHeight()
}
class TextViewCell: UITableViewCell {
var delegate: TextViewCellDelegate?
override func awakeFromNib() {
super.awakeFromNib()
textView.delegate = self
}
@IBOutlet weak var textView: UITextView!
}
extension TextViewCell : UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
delegate?.updateCellHeight()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment