Tooltips in Mac Catalyst v3

Published June 10, 2021

Starting with macOS Monterey, Catalyst apps will now be able to display tooltips; little messages that display on hover to provide the user with helpful hints and context.

Any UIView can be given a tooltip using UIToolTipInteraction like so:

let toolTipView = UIView()
let toolTipMessage = "Tool Tip text"
let toolTipInteraction = UIToolTipInteraction(defaultToolTip: toolTipMessage)
toolTipView.addInteraction(toolTipInteraction)

As one of the most common use cases is to help clarify the function of buttons and other controls, UIControl been given a convenience property, that makes it even easier to had tooltips to any control that conforms:

let button = UIButton(type: .system)
button.toolTip = "Tool Tip Text"