init(_:text:prompt:)
Creates a secure field with a prompt generated from a Text.
Declaration
nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, prompt: Text?)Parameters
- titleKey:
The key for the field’s localized title. The title describes the purpose of the field.
- text:
A binding to the text that the field displays and edits.
- prompt:
A Text view that represents the secure field’s prompt. The prompt provides guidance on what people should type into the secure field.
Discussion
Use the onSubmit(of:_:) modifier to invoke an action whenever someone submits this secure field — for example, by pressing the Return key.