AI-generated Key Takeaways
-
The
ContextualSearchRuntime
class is used for issuing contextual search requests within an app and can be reused throughout its lifecycle. -
This class provides methods for retrieving search content, suggestions, and trending searches based on specified options.
-
Each method, such as
getSearchContent
,getSearchSuggestions
, andgetTrendingSearches
, accepts input options to tailor the search results. -
A new
ContextualSearchRuntime
instance can be created using its initializerinit()
, preferably at app startup for optimal performance.
ContextualSearchRuntime
@objc
final class ContextualSearchRuntime
Runtime for issuing contextual search requests.
The runtime can be reused across the app after it is initialized.
-
Gets search content.
Declaration
Swift
@available(iOS, introduced: 14) @objc final func getSearchContent(withOptions options: GetSearchContentOptions) async throws -> SearchContents
Parameters
withOptions
The input options used to generate search content.
-
Gets search suggestions.
Declaration
Swift
@available(iOS, introduced: 14) @objc final func getSearchSuggestions(withOptions getSearchSuggestionsOptions: GetSearchSuggestionsOptions) async throws -> SearchSuggestions
Parameters
withOptions
The input options used to generate search suggestions.
-
Gets trending searches.
Declaration
Swift
@available(iOS, introduced: 14) @objc final func getTrendingSearches(withOptions getTrendingSearchesOptions: GetTrendingSearchesOptions? = GetTrendingSearchesOptions()) async throws -> SearchSuggestions
Parameters
withOptions
The input options used to generate trending searches.
-
Creates a new Search Runtime.
The Search Runtime can be created at app startup and only needs to be created once. It can be reused throuhgout the app’s lifecycle.
Declaration
Swift
override dynamic convenience init()