A Swift extension on UIView to easily add borders to text fields or labels
- Add Borders.swift to your project
- Add the borders in viewDidLayoutSubviews method, you can optionally define the color. For example:
override func viewDidLayoutSubviews() {
phoneNumberTextField.addBorder(.bottom)
countryCodeLabel.addBorder(.right)
countryCodeLabel.addBorder(.bottom)
}
Result:
Twitter: @gusta_nas
Website: gustanas.co