<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/searchCompletion(_:)-2uaf3",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE16searchCompletionyQrSSF"
  },
  "title" : "searchCompletion(_:)"
}
-->

# searchCompletion(_:)

Associates a fully formed string with the value of this view when used
as a search suggestion.

```
nonisolated func searchCompletion(_ 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 search suggestion list context. The system
uses this value when the view is selected to replace the
partial text being currently edited of the associated search field.

On tvOS, the string that you provide to the this modifier is
used when displaying the associated suggestion and when
replacing the partial text of the search field.

```
SearchPlaceholderView()
    .searchable(text: $text) {
        Text("🍎").searchCompletion("apple")
        Text("🍐").searchCompletion("pear")
        Text("🍌").searchCompletion("banana")
    }
```

---

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)