Pop-Up Buttons in Mac Catalyst v3

Published June 10, 2021

Starting with macOS Monterey, Catalyst apps will now be able to use pop-up buttons.

Simply set a menu to the target button and enable both showsMenuAsPrimaryAction and changesSelectionAsPrimaryAction:

let button = UIButton(type: .system)
button.menu = UIMenu()
button.showsMenuAsPrimaryAction = true
button.changesSelectionAsPrimaryAction = true