<!--
{
  "availability" : [
    "iOS: 17.2.0 -",
    "iPadOS: 17.2.0 -",
    "macCatalyst: -",
    "macOS: 14.2.0 -",
    "tvOS: 17.2.0 -",
    "visionOS: -",
    "watchOS: 10.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/ShowInAppSearchResultsIntent",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents06ShowInA19SearchResultsIntentP"
  },
  "title" : "ShowInAppSearchResultsIntent"
}
-->

# ShowInAppSearchResultsIntent

An app intent that displays a set of search results in the app’s interface.

```
protocol ShowInAppSearchResultsIntent : SystemIntent
```

## Overview

The system uses this protocol to route search requests for your app’s entities to your app. If your app has a search interface,
implement this protocol in a custom type and use it to display the entities that match the provided search criteria. If your app
supports multiple entity types and displays results for each of them differently, provide separate implementations of this type
for each entity.

In your custom type, specify the search criteria you support and the search scope for your app’s content. For most implementations,
use the [`StringSearchCriteria`](/documentation/AppIntents/StringSearchCriteria) type to match the provided string against the text found in your app’s entities. For
most entity types, include the [`StringSearchScope.general`](/documentation/AppIntents/StringSearchScope/general) option in the [`searchScopes`](/documentation/AppIntents/ShowInAppSearchResultsIntent/searchScopes)
property. If your content includes media, update the search scopes to reflect the type of content your app includes.
Use your custom type’s [`perform()`](/documentation/AppIntents/AppIntent/perform()) method to run the search and display the results in your app’s search interface.

The following example shows an implementation of this protocol that uses a string-based search term to locate items. The
[`perform()`](/documentation/AppIntents/AppIntent/perform()) method fetches the string value and passes it to an app-specific type responsible for performing
the search and displaying the results.

```swift
struct MySearchIntent: ShowInAppSearchResultsIntent {
    static let title: LocalizedStringResource = "Search my entities."

    static let searchScopes: [StringSearchScope] = [.general]
    @Parameter var criteria: StringSearchCriteria

    @Dependency var searchManager: SearchManager    // A custom app object.

     func perform() async throws -> some IntentResult {
        let searchTerm = criteria.term       // Get the string value to match against.
        searchManager.displayResults(searchTerm)
        return .result()
    }
}
```

This app intent needs to run from your app, and not from your app extension. If you implement your app intent code in a shared
framework, make sure the [`allowedExecutionTargets`](/documentation/AppIntents/AppIntent/allowedExecutionTargets) property includes your app. The protocol also provides
a default implementation of the [`supportedModes`](/documentation/AppIntents/AppIntent/supportedModes) property that includes the foreground runtime.

> Important: To support Apple Intelligence, define your custom type using the ``doc://com.apple.AppIntents/documentation/AppIntents/AppSchema/SystemIntent/search`` schema,
> which adds support for this protocol automatically to your type.

## Topics

### Providing the search criteria

[`var criteria: Self.Criteria`](/documentation/AppIntents/ShowInAppSearchResultsIntent/criteria-swift.property)

The information to use when performing the search.

[`associatedtype Criteria : SearchCriteria`](/documentation/AppIntents/ShowInAppSearchResultsIntent/Criteria-swift.associatedtype)

[`protocol SearchCriteria`](/documentation/AppIntents/SearchCriteria)

An interface for defining the criteria to use when searching your app’s content.

### Limiting the search scope

[`static var searchScopes: Self.Criteria.SearchScopes`](/documentation/AppIntents/ShowInAppSearchResultsIntent/searchScopes)

The scope of the search in your app’s content.

## Relationships

### Inherits From

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`SystemIntent`](/documentation/AppIntents/SystemIntent)

[`AppIntent`](/documentation/AppIntents/AppIntent)

[`Sendable`](/documentation/Swift/Sendable)

[`PersistentlyIdentifiable`](/documentation/AppIntents/PersistentlyIdentifiable)

---

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)