Contents

init(_:text:prompt:)

Creates a text field with a text label generated from a localized title string resource.

Declaration

@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>, prompt: Text?)

Parameters

  • titleResource:

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

  • text:

    The text to display and edit.

  • prompt:

    A Text representing the prompt of the text field which provides users with guidance on what to type into the text field.

Discussion

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

See Also

Creating a text field with a string