<!--
{
  "availability" : [
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/textInputCompletion(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE19textInputCompletionyQrSSF"
  },
  "title" : "textInputCompletion(_:)"
}
-->

# textInputCompletion(_:)

Associates a fully formed string with the value of this view when used
as a text input suggestion

```
nonisolated func textInputCompletion(_ completion: String) -> some View
```

## Parameters

`completion`

A string to use as the view’s completion.

## Discussion

Use this method to associate a fully formed string with a view that is
within a text input suggestion list context. The system uses this value
when the view is selected to replace the partial text being currently
edited of the associated text field.

```
TextField("Location", text: $addressText)
    .textInputSuggestions(isEnabled: true) {
        Text("The Fillmore")
            .textInputCompletion("1805 Geary Blvd, San Francisco")
        Text("The Catalyst")
            .textInputCompletion("1011 Pacific Ave, Santa Cruz")
        Text("Rio Theatre")
            .textInputCompletion("1205 Soquel Ave, Santa Cruz")
    }
```

---

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)