<!--
{
  "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:placement:prompt:token:)-2c10v",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE10searchable4text6tokens9placement6prompt5tokenQrAA7BindingVySSG_AKyqd__GAA20SearchFieldPlacementVAA18LocalizedStringKeyVqd_0_7ElementSTQyd__ctSkRd__SmRd__AaBRd_0_s12IdentifiableASRQr0_lF"
  },
  "title" : "searchable(text:tokens:placement:prompt:token:)"
}
-->

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

Marks this view as searchable with text and tokens.

```
nonisolated func searchable<C, T>(text: Binding<String>, tokens: Binding<C>, placement: SearchFieldPlacement = .automatic, prompt: LocalizedStringKey, @ContentBuilder token: @escaping (C.Element) -> T) -> some View where C : RandomAccessCollection, C : RangeReplaceableCollection, T : View, 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.

`placement`

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

`prompt`

The key for the localized 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)