Global Variable

UICommandTagShare

A value that identifies a command as a Share menu.

Declaration

NSString *const UICommandTagShare;

Discussion

To create a Share menu, add UICommandTagShare to the propertyList of a UICommand or UIKeyCommand object.

Listing 1

Adding a Share menu to the File menu

// Ensure that the builder is modifying the menu bar system.
guard builder.system == UIMenuSystem.main else { return }

let shareCommand = UICommand(title: "Share",
                             action: #selector(share(_:)),
                             propertyList: UICommandTagShare)

let shareMenu = UIMenu(title: "", options: .displayInline, children: [shareCommand])

// Insert the menu into the File menu before the Close menu.
builder.insertSibling(shareMenu, beforeMenu: .close)

See Also

Associating Data

propertyList

An object that contains data to associate with the command.