How to best author a Apple Helpbook for a macOS app?

macOS apps, e.g. Photos.app, provide a help panel to the user.


Is there a way to author such a Help Book in your own macOS app? Is there a way to at least provide a toolbar to be used for a table of contents?

I am asking specifically about the UI and all the user interactions. Not how to generally create and register a helpbook.

Replies

Let me clarify further as it's hard to get a point across without an image.


If you open the Photos.app help (or any help for that matter in macOS Sierra/High Sierra) you'll see a panel.

That panel contains a "Browse Topics" button that toggles the sidebar. As far as I can see, there is no way to author a help book with a sidebar or provide a custom view.


There is also a toolbar with the default "sidebar" image that toggles the table of contents sidebar.


Is there a way to get that behavior or is it not publicly exposed?

Here is what I’ve been able to find/gather/learn from others. A Help Book appears to run on a separate app/process called “HelpViewer”. Any Apple macOS app displaying a help makes use of a DDMViewerController that isn’t public.


There is an “app.css” and an “app.js” being used by the Apple macOS app “index.html” of the Apple Help Book. The Javascript one manipulates the DOM to create the “show-hide” link that toggles the Sidebar. Haven’t been able to find how to instruct HelpViewer to use a sidebar.


There is a WWDC talk from back in 2014, “Introducing the Modern WebKit API” that talks about “User Scripts” and “Script Messages” which allow communication between a Webview and Cocoa. https://developer.apple.com/videos/play/wwdc2014/206/


AFAICS, there is no way to have HelpViewer display a custom view or have a sidebar. My *guess* is that you would have to implement everything yourself. That is an NSSplitViewController, NSToolbar, NSOutlineView, any Javascript alongside the “app.css” to get the look and feel.