Posts

Showing posts from October, 2019

How to Create Custom Text files in swift iOS

Copy and paste this code for Custom IUTextFiled import Foundation import UIKit class HGTextFiled : UITextField, UITextFieldDelegate {     var textCapitalType : UITextAutocapitalizationType = .none{         didSet{             self.autocapitalizationType = textCapitalType         }     }     override init(frame: CGRect) {         super.init(frame: CGRect.zero)         self.setUp()     }          required init?(coder aDecoder: NSCoder) {         super.init(coder: aDecoder)         self.setUp()     }          override func awakeFromNib() {         super.awakeFromNib()         self.setUp()     }          fileprivate func setUp() {         self.textColor = COLOR.textFiled         self.font = UIFont.init(name: FontName.SemiBold, size: FontSize.Small_12 + 1)         self.backgroundColor = COLOR.White     }     var image : UIImage?     var selectedImage : UIImage?     var imageView : UIImageView?     var maxLenght = Int()               func setKeyboard(keyboardType:UIKeyboardType = .default, r

how to change placeholder color in swift ios

Copy and paste this extension on you project an access this  extension UITextField {     func setPlaceholder(_ color:UIColor)     {         self.attributedPlaceholder = NSAttributedString(string: self.placeholder ?? "", attributes: [NSAttributedString.Key.foregroundColor: color])     } } Used this like txtYouTextFiledName.setPlaceholder(UIColor.red)