** If you would like to implement the same prior to iOS 18** , you can conform to AppIntent rather ShowInAppSearchResultsIntent.
You can have a parameter that takes in a line of text :
@Parameter(title: "Enter the search text:", inputOptions: String.IntentInputOptions.init(multiline: false))
var helpText: String
Sample Code :
struct SearchIntent: AppIntent {
static let title: LocalizedStringResource = "Search"
static var openAppWhenRun: Bool = false
@Parameter(title: "Enter the search text", inputOptions: String.IntentInputOptions.init(multiline: false))
var searchText: String
@MainActor
func perform() async throws -> some IntentResult { // & ProvidesDialog & ShowsSnippetView
//Do your processing here
return .result(result: "I found something related to your search (searchText)")
}
}