How is Lyft suggesting my phone number in the QuickType bar so that I do not have to enter it manually? I know Apple introduced autofill functionality for usernames, passwords, security codes, and more with iOS 12 and it looks like this phone number suggestion may be using a similar function but I cannot figure out how to get any of my apps to suggest the phone number like Lyft is doing below.
3 Answers
From Interface Builder / Storyboard
- Select a textField.
- Show the Attributes inspector.
From Code
You can access this property in any UITextField
textField.textContentType = .telephoneNumber
-
1it is not showing the suggestions for keyboardType set to 'phonePad'. Jun 9, 2020 at 6:21
As @Rob said in a comment below my question.
textField.textContentType = UITextContentType.telephoneNumber
Results in the behavior I was looking for. Thanks @Rob
-
1
UITextContentType
is redundanttextField.textContentType = .telephoneNumber
Feb 24, 2019 at 22:59 -
1textField.textContentType = .telephoneNumber Not working in iOS 14.2 Dec 29, 2020 at 16:53
Phone number autofill strong solution:
textField.keyboardType = .asciiCapableNumberPad
textField.textContentType = .telephoneNumber
textContentType
to.telephoneNumber
and you get this behavior.UITextField
text content type to.phoneNumber
, too, it will automatically pull the verification code from the SMS and presented as an option, too. Really streamlines SMS-based verification workflows.