3

I'm trying to implement an UIMenuController with some UIMenuItems in a Mac Catalyst app with the following:

let menu = UIMenuController.shared
menu.menuItems = [itemA(), itemB(), itemC()]
menu.showMenu(from: someView, rect: someView.bounds)

// itemB and itemC are just as the following
private func itemA() -> UIMenuItem {
    let item = UIMenuItem(title: "Some item", action: #selector(test))
    return item
}

The menu is shown but I cannot find a way to create submenus, for example:

itemA() expands for itemB() and itemC()

How can I achieve this?

Example imageexample

Ivan Cantarino
  • 3,058
  • 4
  • 34
  • 73
  • 1
    You can’t do that with UIMenuController, you have to use the new context menu system: https://kylebashour.com/posts/context-menu-guide – Adam May 26 '20 at 17:26

0 Answers0