The process to create an help book for a MacOS is not very well documented. The available documentation is old and archived: link.
From that old documentation and some of the information found on the Apple Developer Forum I was able to create an Help book for a SwiftUI application.
The book structure
Assume that the name of the application is XXX and the author has domain bogus.com.
Create The following structure:
The files in the directory English.lproj are the content. So a main page index.html which loads some logo from the file utl_download_9531nu_logo.svg and has a link to a secondary page mainPage.html. The content is fully free, it is just standard HTML and the main page doesn’t even have to be named index.html.
The file Info.plist has the following content:
Because the file is named Info.plist, the key names are translated to their textual meaning. If you temporarily rename this file to, e.g. XXX.plist it will reveal the actual key names:
Enabling the help
Just creating the help book doesn’t have any immediate effect. It must be enabled in the Info.plist of the application. Add the following two keys:
This file should already have other entries, but they are left out because they are not relevant for building a help book.
Create the index file
To make your help book searchable, you have to create a file named help.helpindex.
On the command line run, the following command:
hiutil -Cf XXX.help/Contents/Resources/English.lproj/help.helpindex XXX.help/Contents/Resources/English.lproj/
This will create the file help.helpindex:
Note that in order to make your index really searchable, your files should provide hints:
Keywords
Abstracts
For more details see link
Installing the help
Finally, the help book must be copied when you build the application.
- Select the name of the project
- Select the proper target
- Select the build phases
- Install your help book as a bundle
Run the application
Finally run your application and check out your help page. There is no need to make any change in your application to enable the help book.