<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIToolTipInteractionDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIToolTipInteractionDelegate"
  },
  "title" : "UIToolTipInteractionDelegate"
}
-->

# UIToolTipInteractionDelegate

An interface that provides tooltip settings to an interaction.

```
@MainActor protocol UIToolTipInteractionDelegate : NSObjectProtocol
```

## Overview

A tooltip interaction delegate provides configuration information about a tooltip. You can, for instance, use the delegate to change the text of a tooltip.

To change the tooltip text, set a tooltip interaction’s [`delegate`](/documentation/UIKit/UITextInteraction/delegate) property to an object that conforms to the [`UIToolTipInteractionDelegate`](/documentation/UIKit/UIToolTipInteractionDelegate) protocol and implements the [`toolTipInteraction(_:configurationAt:)`](/documentation/UIKit/UIToolTipInteractionDelegate/toolTipInteraction(_:configurationAt:)) method. For example, in the following code listing, the code creates a new view and assigns its background color. Then the code creates a [`UIToolTipInteraction`](/documentation/UIKit/UIToolTipInteraction) object, sets the [`delegate`](/documentation/UIKit/UITextInteraction/delegate) equal to the view, and adds the interaction to the view.

```swift
lazy var viewWithBackgroundColorTooltip: UIView = {
    let view = ViewWithBackgroundColorTooltip()
    view.backgroundColor = UIColor.systemYellow
    
    let tooltipInteraction = UIToolTipInteraction()
    tooltipInteraction.delegate = view
    view.addInteraction(tooltipInteraction)
    
    return view
}()
```

The delegate’s implementation of the [`toolTipInteraction(_:configurationAt:)`](/documentation/UIKit/UIToolTipInteractionDelegate/toolTipInteraction(_:configurationAt:)) method looks up the [`accessibilityName`](/documentation/UIKit/UIColor/accessibilityName) of the view’s background color. If the name is available, the method creates a [`UIToolTipConfiguration`](/documentation/UIKit/UIToolTipConfiguration) object, passing in the name of the color. Then the method returns the configuration. If the name isn’t available, the method returns `nil`, which prevents the display of the tooltip.

```swift
class ViewWithBackgroundColorTooltip: UIView, UIToolTipInteractionDelegate {
    
    func toolTipInteraction(_ interaction: UIToolTipInteraction, configurationAt point: CGPoint) -> UIToolTipConfiguration? {

        let configuration: UIToolTipConfiguration?
        if let accessibilityName = backgroundColor?.accessibilityName {
            configuration = UIToolTipConfiguration(toolTip: "The color is \(accessibilityName).")
        } else {
            configuration = nil
        }
        
        return configuration
    }

}
```

In addition to changing the tooltip text, you can also specify the region within a view or control where a person must position the pointer to trigger the display of the tooltip. To specify the region, create the tooltip configuration using the [`init(toolTip:in:)`](/documentation/UIKit/UIToolTipConfiguration/init(toolTip:in:)) method.

## Topics

### Providing a tooltip configuration

[`toolTipInteraction(_:configurationAt:)`](/documentation/UIKit/UIToolTipInteractionDelegate/toolTipInteraction(_:configurationAt:))

Asks the delegate for a tooltip configuration that describes the tooltip settings.

[`UIToolTipConfiguration`](/documentation/UIKit/UIToolTipConfiguration)

An object that a tooltip interaction delegate uses to describe the tooltip settings.



---

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)