textContentType
Sets the text content type for this view, which the system uses to offer suggestions while the user enters text on an iOS or tvOS device.
Declaration
compose().textContentType(
textContentType: ('name' | 'givenName' | 'familyName' | 'nickname' | 'organizationName' | 'fullStreetAddress' | 'postalCode' | 'telephoneNumber' | 'emailAddress' | 'URL' | 'creditCardNumber' | 'username' | 'password' | 'newPassword' | 'oneTimeCode' | (string & {})) | null
)nonisolated func textContentType(
_ textContentType: UITextContentType?
) -> some ViewParameters
textContentType*('name' | 'givenName' | 'familyName' | 'nickname' | 'organizationName' | 'fullStreetAddress' | 'postalCode' | 'telephoneNumber' | 'emailAddress' | 'URL' | 'creditCardNumber' | 'username' | 'password' | 'newPassword' | 'oneTimeCode' | (string & {})) | nullOne of the content types available in the doc://com.apple.documentation/documentation/UIKit/UITextContentType structure that identify the semantic meaning expected for a text-entry area. These include support for email addresses, location names, URLs, and telephone numbers, to name just a few.
Discussion
Use this method to set the content type for input text.
For example, you can configure a TextField for the entry of email
addresses:
TextField("Enter your email", text: $emailAddress)
.textContentType(.emailAddress)See also
More in Text and symbols.
- allowsTighteningSets whether text in this view can compress the space between characters when necessary to fit text in a line.
- autocorrectionDisabledSets whether to disable autocorrection for this view.
- baselineOffsetSets the vertical offset for the text relative to its baseline in this view.
- boldApplies a bold font weight to the text in this view.
- findDisabledPrevents find and replace operations in a text editor.
- findNavigatorProgrammatically presents the find and replace interface for text editor views.
- fontSets the default font for text in this view.
- fontDesignSets the font design of the text in this view.
- fontWeightSets the font weight of the text in this view.
- fontWidthSets the font width of the text in this view.
- interactionActivityTrackingTagSets a tag that you use for tracking interactivity.
- italicApplies italics to the text in this view.