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)
}
}