Примерно так:
#if targetEnvironment(macCatalyst)
extension AppDelegate {
override func buildMenu(with builder: UIMenuBuilder) {
guard builder.system == .main else { return }
// override about button
builder.replaceChildren(ofMenu: .about) { (oldChildren) -> [UIMenuElement] in
let menuElement = oldChildren.first
if let uiCommand = menuElement as? UICommand {
let aboutUICommand = UICommand(title: uiCommand.title,
action: #selector(aboutApp(_:)))
return [aboutUICommand]
} else {
return oldChildren
}
}
}
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return super.canPerformAction(action, withSender: sender)
}
override func target(forAction action: Selector, withSender sender: Any?) -> Any? {
if action == #selector(aboutApp) {
return self
} else {
return nil
}
}
@objc func aboutApp(_ selector: Any?) {
guard let aboutTVC = AboutViewController.createInstance() else { return; }
rootViewController?.present(aboutTVC, animated: true, completion: nil)
}
}
#endif