<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/ContactResolver",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Core Spotlight",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:31_CoreSpotlight_FoundationModels15ContactResolverP"
  },
  "title" : "ContactResolver"
}
-->

# ContactResolver

An interface you use to help Foundation models resolve references to the person using the app.

```
protocol ContactResolver : Sendable
```

## Overview

When a search involves people, the search tool needs to know how to resolve references to “I” or “me” in any conversations.
Implement this protocol in a custom type and assign it to the Spotlight search tool you use with your Foundation models session.
Your custom type returns a [`ResolvedContact`](/documentation/CoreSpotlight/ResolvedContact) structure, which contains any information your app uses to refer to the person.
For example, fill the structure with name information, email addresses, or phone numbers from the account your app manages.

The following example shows an implementation of this structure and the code you use to assign it to your Spotlight search tool.

```swift
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()
```

## Topics

### Returning the identity data

[`func userIdentity() -> ResolvedContact`](/documentation/CoreSpotlight/ContactResolver/userIdentity())

Returns the information for the current contact.

## Relationships

### Inherits From

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

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

---

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)