Fix text view placeholder bug
This commit is contained in:
parent
b2c6a5229b
commit
bc91d9ef0c
|
@ -3,6 +3,8 @@ public final class InputTextView : UITextView, UITextViewDelegate {
|
|||
private let snDelegate: InputTextViewDelegate
|
||||
private lazy var heightConstraint = self.set(.height, to: minHeight)
|
||||
|
||||
public override var text: String! { didSet { handleTextChanged() } }
|
||||
|
||||
// MARK: UI Components
|
||||
private lazy var placeholderLabel: UILabel = {
|
||||
let result = UILabel()
|
||||
|
@ -52,6 +54,10 @@ public final class InputTextView : UITextView, UITextViewDelegate {
|
|||
|
||||
// MARK: Updating
|
||||
public func textViewDidChange(_ textView: UITextView) {
|
||||
handleTextChanged()
|
||||
}
|
||||
|
||||
private func handleTextChanged() {
|
||||
defer { snDelegate.inputTextViewDidChangeContent(self) }
|
||||
placeholderLabel.isHidden = !text.isEmpty
|
||||
let width = frame.width
|
||||
|
|
Loading…
Reference in New Issue