1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
// // SSTextField.swift // // // Created by Shubham Sharma on 17/01/20. // Copyright © 2020 Shubham Sharma. All rights reserved. // import UIKit @IBDesignable @objc open class SSTextField: UITextField { /// Change placeholder color. @IBInspectable open var placeHolderColor : UIColor = UIColor.lightGray { didSet { self.initialize() } } // MARK:- Loading From NIB override open func awakeFromNib() { super.awakeFromNib() self.initialize() } // MARK:- Intialization override public init(frame: CGRect) { super.init(frame: frame) self.initialize() } required public init(coder aDecoder: NSCoder) { super.init(coder: aDecoder)! self.initialize() } //MARK:- ACFLoating Initialzation. func initialize() -> Void { let iVar = class_getInstanceVariable(UITextField.self, "_placeholderLabel")! if let placeholderLabel = object_getIvar(self, iVar) as? UILabel { placeholderLabel.textColor = placeHolderColor } } } |