ContactResolver
Resolves the current user’s identity for search queries involving people.
Declaration
protocol ContactResolver : SendableMentioned in
Overview
When a search involves people (e.g., “emails from me”, “notes I created yesterday”), the search tool needs to know who “me” is. Implement this protocol to provide the current user’s contact information from your app’s identity source — such as an account profile, Contacts framework, or other source.
Example:
struct MyContactResolver: ContactResolver {
func userIdentity() -> ResolvedContact {
var contact = ResolvedContact(displayName: "John Appleseed")
contact.emailAddresses = ["john@example.com"]
return contact
}
}
var configuration = SpotlightSearchTool.Configuration()
configuration.contactResolver = MyContactResolver()