textInputAutocapitalization

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

View ModifieriOS 15.0+tvOS 15.0+watchOS 8.0+textInputAutocapitalization(_:) in SwiftUI

Declaration

React
compose().textInputAutocapitalization(
  autocapitalization: SwiftUI.TextInputAutocapitalization | null
)
Swift
nonisolated func textInputAutocapitalization(
    _ autocapitalization: TextInputAutocapitalization?
) -> some View

Parameters

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.

defined in the TextInputAutocapitalization struct or nil.

See also

More in Text and symbols.