UIMainMenuSystem: remove "Paste and Match Style" item from Edit menu

The default app menu on iPadOS 26 includes an Edit menu with items (among others) Cut, Copy, Paste, Paste and Match Style. I want to remove the last one.

I tried the following but nothing worked:

let configuration = UIMainMenuSystem.Configuration()
configuration.textFormattingPreference = .removed

UIMainMenuSystem.shared.setBuildConfiguration(configuration) { builder in
    builder.remove(action: .pasteAndMatchStyle)

    if let command = builder.menu(for: .edit)?.children.first(where: { ($0 as? UICommand)?.action == #selector(UIResponderStandardEditActions.pasteAndMatchStyle(_:)) }) as? UICommand {
        command.attributes.insert(.hidden)
    }
}

The Paste and Match Style item, like nearly all default items in the main menu, are commands, not actions. So you should be able to remove it like this:

builder.remove(command: #selector(pasteAndMatchStyle(_:)))

Thanks, that works.

If not for this, what is UIAction.Identifier.pasteAndMatchStyle used for?

UIMainMenuSystem: remove "Paste and Match Style" item from Edit menu
 
 
Q