In objective-c I can just say the following.
[self.promoTextField setKeyboardType:UIKeyboardTypeEmailAddress];
I tried googling it but just get ways to do it in objective-c.
An object that displays an editable text area in your interface.
Try this :
self.promoTextField.keyboardType = UIKeyboardType.emailAddress // Or Shorter version self.promoTextField.keyboardType = .emailAddress
self.promoTextField.keyboardType = UIKeyboardType.EmailAddress
The documentation about UITextInputTraits
, a protocol adopted by UITextField
, says it's still here:
optional var keyboardType: UIKeyboardType { get set }
And the list of all keyboardType
s is here :
enum UIKeyboardType : Int { case Default case ASCIICapable case NumbersAndPunctuation case URL case NumberPad case PhonePad case NamePhonePad case EmailAddress case DecimalPad case Twitter case WebSearch }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With