---
title: "searchSuggestions(_:for:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/searchsuggestions(_:for:)"
---

# searchSuggestions(_:for:)

Configures how to display search suggestions within this view.

## Declaration

```swift
nonisolated func searchSuggestions(_ visibility: Visibility, for placements: SearchSuggestionsPlacement.Set) -> some View

```

## Parameters

- `visibility`: The visibility of the search suggestions for the specified locations.
- `placements`: The set of locations in which to set the visibility of search suggestions.

## Discussion

Discussion SwiftUI presents search suggestions differently depending on several factors, like the platform, the position of the search field, and the size class. Use this modifier when you want to only display suggestions in certain ways under certain conditions. For example, you might choose to display suggestions in a menu when possible, but directly filter your data source otherwise. enum FruitSuggestion: String, Identifiable {     case apple, banana, orange     var id: Self { self } }

@State private var text = "" @State private var suggestions: [FruitSuggestion] = []

var body: some View {     MainContent()         .searchable(text: $text) {             ForEach(suggestions) { suggestion                 Text(suggestion.rawValue)                     .searchCompletion(suggestion.rawValue)             }             .searchSuggestions(.hidden, for: .content)         } }

## See Also

### Making search suggestions

- [Suggesting search terms](swiftui/suggesting-search-terms.md)
- [searchSuggestions(_:)](swiftui/view/searchsuggestions(_:).md)
- [searchCompletion(_:)](swiftui/view/searchcompletion(_:).md)
- [searchable(text:tokens:suggestedTokens:placement:prompt:token:)](swiftui/view/searchable(text:tokens:suggestedtokens:placement:prompt:token:).md)
- [SearchSuggestionsPlacement](swiftui/searchsuggestionsplacement.md)
