Multilanguage Docc Documentation

Using Xcode 14.2, Swift 5.7.

Workspace with two projects. Both projects comprised of Swift and Obj-C files.

Docc generated documentation for one of the projects contains both Swift & Obj-C API documentation.

The other only contains Swift API documentation.

Looked at the build logs, and the project with both languages output runs through the following documentation-related steps:

  • WriteAuxiliaryFile (extractapi) ...
  • ExtractAPI ...
  • ConvertSDKDBToSymbolGraph ...
  • CompileDocumentation ...

The other, that only generates Swift API documentation has these steps:

  • WriteAuxiliaryFile (extractapi) ...
  • CompileDocumentation ...

Looking for ideas on how to ensure ExtractAPI and ConvertSDKDBToSymbolGraph steps occur for the latter project. Believe those steps are the reason for missing Obj-C documentation.

Is there a build setting (or some other setting) missing that leads to no Obj-C API documentation?

There are a handful of different factors that decide whether or not Xcode builds Objective-C API documentation for a given target. It's hard to tell which factors make the difference between these two projects based on the provided information.

The API documentation represents what symbols are available to a consumer of a framework/library or to a contributor of an app/tool/executable. For Swift this means that Xcode builds documentation for public symbols for framework/library targets and for internal symbols for app/tool/executable targets. For Objective-C and C, Xcode builds documentation for the symbols that are available in certain headers. For frameworks and libraries this means the public headers for that target. You can see which headers are public, private, and project visible in the target's Headers build phase. For app/tool/executable targets the documentation includes symbols from headers of all visibility levels. App/tool/executable targets don't need a Header build phase. In this case the headers are discovered based on the Objective-C and C source files for that target.

One reason for not seeing any Objective-C symbols in the built documentation is that there are no headers with sufficient visibility for that target. Depending on the type of target you can check its Header build phase to see if the headers are too low visibility to be included in the documentation.

There are no specific build settings that turns off Objective-C API documentation. There are 2 opt-in build settings that enable multi-language representation of Swift-only and Objective-C only symbols (if you have a Swift-only framework you can opt-in to include the generated Objective-C declarations in the documentation and vice versa) but wouldn't solve your issue here because it would only enable Objective-C declarations for the Swift symbols in your documentation. It doesn't affect the documentation for your Objective-C symbols. Targets with both documentation for both Swift and Objective-C symbols generate multi-language representations for all applicable symbols.

Multilanguage Docc Documentation
 
 
Q