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

# toolTipInteraction

The tooltip interaction associated with the control.

```
var toolTipInteraction: UIToolTipInteraction? { get }
```

## Discussion

When you set the [`toolTip`](/documentation/UIKit/UIControl/toolTip) property, the control creates a [`UIToolTipInteraction`](/documentation/UIKit/UIToolTipInteraction) object and assigns it to the [`toolTipInteraction`](/documentation/UIKit/UIControl/toolTipInteraction) property.

If you want to change the text of the tooltip based the current state of your app or application logic, assign a [`UIToolTipInteractionDelegate`](/documentation/UIKit/UIToolTipInteractionDelegate) object to [`toolTipInteraction`](/documentation/UIKit/UIControl/toolTipInteraction)‘s [`delegate`](/documentation/UIKit/UIToolTipInteraction/delegate) property. For example, the following code listing sets the tooltip’s default text and delegate for a shopping cart button:

```swift
lazy var shoppingCartButtonWithTooltip: UIButton = {
    var configuration = UIButton.Configuration.filled()
    configuration.title = "Add to Cart"
    configuration.image = UIImage(systemName: "cart", variant: .circle)
    configuration.imagePlacement = NSDirectionalRectEdge.leading
    configuration.imagePadding = 4
    
    let action = UIAction { [unowned self] _ in self.cartItemCount += 1 }
    
    let button = UIButton(configuration: configuration, primaryAction: action)
    button.toolTip = "Click to add the item to your cart. Your cart is empty."
    button.toolTipInteraction?.delegate = self
    
    return button
}()
```

Then the delegate returns a tooltip configuration containing text that states the number of items in the shopping cart by implementing the [`toolTipInteraction(_:configurationAt:)`](/documentation/UIKit/UIToolTipInteractionDelegate/toolTipInteraction(_:configurationAt:)) method:

```swift
func toolTipInteraction(_ interaction: UIToolTipInteraction, configurationAt point: CGPoint) -> UIToolTipConfiguration? {
    
    let text: String
    switch cartItemCount {
    case 0:
        text = "Click to add the item to your cart. Your cart is empty."
    case 1:
        text = "Click to add the item to your cart. Your cart contains \(cartItemCount) item."
    default:
        text = "Click to add the item to your cart. Your cart contains \(cartItemCount) items."
    }
    
    return UIToolTipConfiguration(toolTip: text)
}
```

---

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)