---
title: "init(_:text:onEditingChanged:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/textfield/init(_:text:oneditingchanged:)"
---

# init(_:text:onEditingChanged:)

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

## Declaration

```swift
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.

## See Also

### Creating a text field with a string

- [init(_:text:onEditingChanged:onCommit:)](swiftui/textfield/init(_:text:oneditingchanged:oncommit:).md)
- [init(_:text:onCommit:)](swiftui/textfield/init(_:text:oncommit:).md)
