responses
The matching results and suggestions for the current query string.
Declaration
var responses: CSUserQuery.Responses { get }Mentioned in
Discussion
Getting the value of this property starts the query and begins the delivery of responses. Typically, you get this property as part of a for..in loop to iterate over the responses, as shown in the following example:
var results: [CSUserQuery.Item] = []
var suggestions: [CSUserQuery.Suggestion] = []
let query = CSUserQuery(userQueryString: searchText, userQueryContext: queryContext)
for try await element in query.responses {
switch(element) {
case .item(let item):
self.results.append(item)
break
case .suggestion(let suggestion):
self.suggestions.append(suggestion)
break
@unknown default:
break
}
}