I appreciate that it's a couple of years since this issue was last discussed but I was hoping that one of the answers to it would allow me to add a Help menu link to an online guide for an iOS app that I have recently ported to macOS via Mac Catalyst. My app uses the SwiftUI lifecycle so I had to add an AppDelegate manually, which I did following guidance at hackingwithswift.com. Oscar's reply helped me on my way and I was able to insert a link in the Help menu; however, the link was always disabled. Eventually I found a solution, which was to discard Oscar's helpAction() @objc function and to replace:
let helpKeyCommand = UIKeyCommand(input: "?", modifierFlags: [.command], action: #selector(helpAction))
helpKeyCommand.title = NSLocalizedString("YOUR_APP_NAME Help", comment: "")
let newHelpMenu = helpMenu.replacingChildren([helpKeyCommand])
builder.replace(menu: .help, with: newHelpMenu)
with:
let openHelpAction = UIAction(title: "YOUR_APP_NAME Help") { (action) in
//Your code here
}
let newHelpMenu = helpMenu.replacingChildren([openHelpAction])
builder.replace(menu: .help, with: newHelpMenu)
The action code in my own openHelpAction is simply:
UIApplication.shared.open(URL(string: "https://www.crizzle.co.uk/inetworthHelp/index.html")!)
I now have an operational Help menu capability in the Mac Catalyst version of my iOS app and I will be uploading the new version to the Mac App Store very soon. By the way, I have not had any issues with the lack of a help capability resulting in app rejection by the App Review process. I used to ship .help files with my apps but something changed to the .help UTType between Big Sur and Monterey, making the display of help files in HelpViewer very hit and miss, so I started shipping my apps with links to an online guide to be sure that help is always available (as long as the user is online); a side benefit of doing this was a significant reduction in the size of my app packages.
Another 'by the way' that might help users, who are based in the UK (where Help Crafter is not available) and want to generate Apple-like online help guides, is a suggestion to try out the help file generation capability at this link: Middlemac. Middlemac is not as easy to use as Help Crafter and requires extensive use of the CLI in Terminal; however, the results are, I believe, very good.