updated placeholder logic

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-07-10 16:33:54 -05:00
parent d7086b0702
commit d943202e83

View File

@ -45,11 +45,7 @@ open class TextView: UITextView, ViewProtocol, Errorable {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
open var placeholder: String? { open var placeholder: String? { didSet { setNeedsUpdate() } }
didSet {
placeholderLabel.text = placeholder
}
}
open var placeholderLabel = Label().with { open var placeholderLabel = Label().with {
$0.textColorConfiguration = ViewColorConfiguration().with { $0.textColorConfiguration = ViewColorConfiguration().with {
@ -319,8 +315,9 @@ open class TextView: UITextView, ViewProtocol, Errorable {
attributedText = nil attributedText = nil
} }
placeholderLabel.textStyle = textStyle placeholderLabel.textStyle = textStyle
placeholderLabel.isHidden = !text.isEmpty
placeholderLabel.surface = surface placeholderLabel.surface = surface
placeholderLabel.text = placeholder
placeholderLabel.isHidden = !text.isEmpty
} }
} }