// // RoundTextField.swift // Sirani // // Created by Anhar Solehudin on 26/03/19. // Copyright © 2019 Anhar Solehudin. All rights reserved. // import UIKit @IBDesignable class RoundTextField: UITextField { let padding = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16) override open func textRect(forBounds bounds: CGRect) -> CGRect { return bounds.inset(by: padding) } override open func placeholderRect(forBounds bounds: CGRect) -> CGRect { return bounds.inset(by: padding) } override open func editingRect(forBounds bounds: CGRect) -> CGRect { return bounds.inset(by: padding) } override func prepareForInterfaceBuilder() { customizeView() } override func awakeFromNib() { super.awakeFromNib() customizeView() } func customizeView() { backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) layer.cornerRadius = 5.0 layer.borderWidth = 1.0 layer.borderColor = #colorLiteral(red: 0.1886746883, green: 0.3115345836, blue: 0.6041364074, alpha: 1) } func getText() -> String? { return self.text } }