Contents

init(_:text:axis:)

Creates a text field with a preferred axis and a text label generated from a localized title string.

Declaration

nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, axis: Axis)

Parameters

  • titleKey:

    The key for the localized title of the text field, describing its purpose.

  • text:

    The text to display and edit.

  • axis:

    The axis in which to scroll text when it doesn’t fit in the available space.

Discussion

Specify a preferred axis in which the text field should scroll its content when it does not fit in the available space. Depending on the style of the field, this axis may not be respected.

Use the onSubmit(of:_:) modifier to invoke an action whenever the user submits this text field.

See Also

Creating a scrollable text field