<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/searchSuggestions(_:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE17searchSuggestions_3forQrAA10VisibilityO_AA06SearchE9PlacementV3SetVtF"
  },
  "title" : "searchSuggestions(_:for:)"
}
-->

# searchSuggestions(_:for:)

Configures how to display search suggestions within this view.

```
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

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)
        }
}
```

---

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)