Example 1
- textfield is constrained horizontally to screen bounds
- textfield has constrained height
let fixedWidthPhoneField = PhoneTextField()
fixedWidthPhoneField.font = .systemFont(ofSize: 30)
fixedWidthPhoneField.formattingMask = "+7 (###) ###-##-##"
fixedWidthPhoneField.exampleMask = "+7 (123) 456-78-90"
fixedWidthPhoneField.textAlignment = .center
fixedWidthPhoneField.clearButtonMode = .whileEditing
Example 2
- textfield is using
intinsicContentSize to calculate its size
let adaptiveWidthPhoneField = PhoneTextField()
adaptiveWidthPhoneField.font = UIFont(name: "Courier", size: 24)
adaptiveWidthPhoneField.formattingMask = "+7 (###) ###-##-##"
adaptiveWidthPhoneField.exampleMask = "+7 (___) ___-__-__"
adaptiveWidthPhoneField.clearButtonMode = .always