I had no trouble replacing the View menu with code similar to the following:
override func buildMenu(with builder: any UIMenuBuilder) {
super.buildMenu(with: builder)
if builder.system == .main {
let cmd = UIKeyCommand(title: "Hello", image:nil, action:#selector(doStuff), input: "1", modifierFlags: .command)
let menu = UIMenu(image: nil, options: .displayInline, children: [cmd])
if let view = builder.menu(for: .view) {
let newView = view.replacingChildren([menu])
builder.replace(menu: .view, with: newView)
}
}
}
With that code the View menu only shows the one menu item I created.
Tested with Xcode 26 beta 7 running on a simulated iPad running iPadOS 26 beta 6.
Topic:
UI Frameworks
SubTopic:
UIKit