Instance Method

buildCommands(with:)

Asks the receiving responder to add and remove items from a command system.

Declaration

func buildCommands(with builder: UICommandBuilder)

Parameters

builder

An object that you use to modify a command system for your app.

Discussion

Override this method in your app delegate or view controller to receive a builder object. Use the builder to add and remove UICommand and UICommandGroup objects from your app's menu bar or context menus.

Where you override this method determines the command system that the builder updates. To add and remove items from the menu bar using the main command system, override buildCommands(with:) in your app delegate. To build a context menu using the context system, override this method in your view controller.

See Also

Building and Validating Commands

func validate(UICommand)

Asks the receiving responder to validate the command.

Beta
func canPerformAction(Selector, withSender: Any?) -> Bool

Requests the receiving responder to enable or disable the specified command in the user interface.

func target(forAction: Selector, withSender: Any?) -> Any?

Returns the target object that responds to an action.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software