File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,22 @@ public class TweePlaceholderTextField: UITextField {
5555 /// Custom placeholder label. You can use it to style placeholder text.
5656 public private( set) lazy var placeholderLabel = UILabel ( )
5757
58+ public override var text : String ? {
59+ didSet {
60+ if let text = text, text. isEmpty == false {
61+ minimizePlaceholder ( )
62+ }
63+ }
64+ }
65+
66+ public override var attributedText : NSAttributedString ? {
67+ didSet {
68+ if let attrText = attributedText, attrText. string. isEmpty == false {
69+ minimizePlaceholder ( )
70+ }
71+ }
72+ }
73+
5874 // Private
5975
6076 private var minimizeFontAnimation : FontAnimation !
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ final class ViewController: UIViewController {
2222
2323 override func viewDidLoad( ) {
2424 super. viewDidLoad ( )
25+ usernameTextField. text = " text "
2526 }
2627
2728 @IBAction private func confirm( ) {
You can’t perform that action at this time.
0 commit comments