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

textInputAutocapitalization(_:)

Sets how often the shift key in the keyboard is automatically enabled.

Declaration 宣言

func textInputAutocapitalization(_ autocapitalization: TextInputAutocapitalization?) -> some View

Parameters パラメータ

autocapitalization

One of the capitalizing behaviors defined in the TextInputAutocapitalization struct or nil.

Discussion 議論

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

In example below, as the user enters text the shift key is automatically enabled before every word:


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

The TextInputAutocapitalization struct defines the available autocapitalizing behavior. Providing nil to this view modifier does not change the autocapitalization behavior. The default is TextInputAutocapitalization.sentences.

See Also 参照

Configuring Text Entry