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

# init(_:text:)

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

## Declaration

```swift
nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>)
```

## Parameters

- `titleKey`: The key for the localized title of the text field, describing its purpose.
- `text`: The text to display and edit.

## See Also

### Creating a text field with a string

- [init(_:text:prompt:)](swiftui/textfield/init(_:text:prompt:).md)
- [init(text:prompt:label:)](swiftui/textfield/init(text:prompt:label:).md)
