<!--
{
  "availability" : [
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TextFieldLink/init(_:prompt:onSubmit:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13TextFieldLinkVA2A0C0VRszrlE_6prompt8onSubmitACyAEG10Foundation23LocalizedStringResourceV_AESgySSctcfc::OverloadGroup"
  },
  "title" : "init(_:prompt:onSubmit:)"
}
-->

# init(_:prompt:onSubmit:)

Creates a TextFieldLink which when pressed will request text input from
the user.

```
@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, prompt: Text? = nil, onSubmit: @escaping (String) -> Void)
```

## Parameters

`titleResource`

A key for the TextFieldLink’s localized title, that
describes the purpose of requesting text input.

`prompt`

Text which describes the reason for requesting text input.

`onSubmit`

An action to perform when text input has been accepted and
dismissed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)