Here's the documentation on UITextField's textContentType property:
Use this property to give the keyboard and the system information about the expected semantic meaning for the content that users enter. For example, you might specify
UITextContentTypeEmailAddress
for a text field that users fill in to receive an email confirmation. When you provide this information about the content you expect users to enter in a text-entry area, the system can in some cases automatically select an appropriate keyboard and improve keyboard corrections and proactive integration with other text-entry opportunities.Because the expected semantic meaning for each text-entry area should be identified as specifically as possible, you can’t combine multiple values for one
textContentType
property. For possible values you can use, see Text Content Types; by default, the value of this property isnil
.
This seems pretty straightforward, but I can't figure out how to make this actually do anything. I created a simple demo app, added a text field, and set self.textField.textContentType = UITextContentTypeEmailAddress
. Then I ran it on an iPhone 7 with iOS 10.0.1.
At the very least I expected this to automatically select the email keyboard, without having to explicitly set it. It does not—I get the standard keyboard on my iPhone.
I also expected it to show my own email addresses for the QuickType suggestions. I've seen this happen elsewhere—if I'm in Safari and it detects that I'm editing an email field, it shows my home and work email addresses as suggestions. Again, it does not do that here, even though the documentation suggests that it should.
Even if I also set the keyboardType
to UIKeyboardTypeEmailAddress
, I still don't get the QuickType suggestions I was expecting.
There's a WWDC talk that discusses this new capability, but there's never any suggestion that you need to do anything other than set this single property.
Am I missing some step, or does this not actually do what I'm expecting?