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

# delegate

An object that provides text that a tooltip displays instead of the default text.

```
weak var delegate: (any UIToolTipInteractionDelegate)? { get set }
```

## Discussion

To provide tooltip text based on the current state or unique logic of your app, set the [`delegate`](/documentation/UIKit/UIToolTipInteraction/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. The method returns a [`UIToolTipConfiguration`](/documentation/UIKit/UIToolTipConfiguration) object containing the text to display in the tooltip. For example, the following code listing instructs the tooltip to show the name of the view’s background color instead of the [`defaultToolTip`](/documentation/UIKit/UIToolTipInteraction/defaultToolTip) text. If the color name is unavailable, the method returns `nil`, which disables the display of the tooltip.

```swift
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
}
```

---

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)