Created
April 2, 2021 14:49
-
-
Save jamestapping/9d3077a1f7b3fc4b27f5f83d647e5bba to your computer and use it in GitHub Desktop.
Medium TableView TextView example - TextViewCell.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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