<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/searchable(text:tokens:suggestedTokens:placement:prompt:token:)-8xk6g",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE10searchable4text6tokens15suggestedTokens9placement6prompt5tokenQrAA7BindingVySSG_ALyqd__GAnA20SearchFieldPlacementVqd_1_qd_0_7ElementSTQyd__ctSMRd__SkRd__SmRd__AaBRd_0_SyRd_1_s12IdentifiableARRQr1_lF"
  },
  "title" : "searchable(text:tokens:suggestedTokens:placement:prompt:token:)"
}
-->

# searchable(text:tokens:suggestedTokens:placement:prompt:token:)

Marks this view as searchable with text, tokens, and suggestions.

```
nonisolated func searchable<C, T, S>(text: Binding<String>, tokens: Binding<C>, suggestedTokens: Binding<C>, placement: SearchFieldPlacement = .automatic, prompt: S, @ContentBuilder token: @escaping (C.Element) -> T) -> some View where C : MutableCollection, C : RandomAccessCollection, C : RangeReplaceableCollection, T : View, S : StringProtocol, C.Element : Identifiable
```

## Parameters

`text`

The text to display and edit in the search field.

`tokens`

A collection of tokens to display and edit in the
search field.

`suggestedTokens`

A collection of tokens to display as suggestions.

`placement`

The preferred placement of the search field within the
containing view hierarchy.

`prompt`

A string representing the prompt of the search field
which provides users with guidance on what to search for.

`token`

A content builder that creates a view given an element in
tokens.

## Discussion

For more information about using searchable modifiers, see
<doc:Adding-a-search-interface-to-your-app>.

---

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)