<!--
{
  "availability" : [
    "iOS: 13.0.0 - 27.2.0",
    "iPadOS: 13.0.0 - 27.2.0",
    "macCatalyst: 13.0.0 - 27.2.0",
    "macOS: 10.15.0 - 27.2.0",
    "tvOS: 13.0.0 - 27.2.0",
    "visionOS: 1.0.0 - 27.2.0",
    "watchOS: 6.0.0 - 27.2.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TextField/init(_:text:onEditingChanged:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI9TextFieldVA2A0C0VRszrlE_4text16onEditingChangedACyAEGAA18LocalizedStringKeyV_AA7BindingVySSGySbctcfc::OverloadGroup"
  },
  "title" : "init(_:text:onEditingChanged:)"
}
-->

# init(_:text:onEditingChanged:)

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

```
@export(implementation) nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, onEditingChanged: @escaping (Bool) -> Void)
```

## Parameters

`titleKey`

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

`text`

The text to display and edit.

`onEditingChanged`

The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.

---

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)