How to add underline to UITextField in Swift 3
UITextField Underlined In Swift 3
Create a custom UITexField and add this method to it then override
layoutSubviews() and call it from there
func underlined(){
let border = CALayer()
let lineWidth = CGFloat(0.3)
border.borderColor = UIColor.lightGray.cgColor
border.frame = CGRect(x: 0, y: self.frame.size.height - lineWidth, width: self.frame.size.width, height: self.frame.size.height)
border.borderWidth = lineWidth
self.layer.addSublayer(border)
self.layer.masksToBounds = true
}
Good to know How to change UITextField placeholder color