Instance Method インスタンスメソッド

autocapitalization(_:)

Sets whether to apply auto-capitalization to this view. 自動キャピタライゼーションをこのビューに適用すべきかどうかを設定します。

Declaration 宣言

func autocapitalization(_ style: UITextAutocapitalizationType) -> some View

Parameters パラメータ

style

One of the autocapitalization modes defined in the UITextAutocapitalizationType enumeration.

Discussion 議論

Use autocapitalization(_:) when you need to automatically capitalize words, sentences, or other text like proper nouns.

In example below, as the user enters text each word is automatically capitalized:


TextField("Last, First", text: $fullName)
    .autocapitalization(UITextAutocapitalizationType.words)

The UITextAutocapitalizationType enumeration defines the available capitalization modes. The default is UITextAutocapitalizationType.sentences.