(How) Can I use DocC for internal documentation?

  • In personally, I thought that too! DocC is an amazing feature to create great documentation.

    It'd be so much better if we use that for internal symbols. Because in a big application, there would be a bunch of symbols and they might be internal since those needed by only application target.

Add a Comment

Apple Recommended

  • Thanks for the reply! Please see FB9144883, I’ll be able to provide more details as needed. The most important aspects (apart from documenting a superset of publicopen symbols) would be use of pictures for diagrams of general architecture, lock-acquisition-order etc. in internal documentation — also for Objective-C(++) (see: FB9144975).

Add a Comment

Replies

  • Thanks for the reply! Please see FB9144883, I’ll be able to provide more details as needed. The most important aspects (apart from documenting a superset of publicopen symbols) would be use of pictures for diagrams of general architecture, lock-acquisition-order etc. in internal documentation — also for Objective-C(++) (see: FB9144975).

Add a Comment

-Deleted this post because it was not answer it's just a comment to this topic-

Any update on that topic ? I've basically got the same requirement. Need to document an internal framework, aka : all its structs and classes, and not just the public ones.

By a strange coincidence I just saw a thread about this on Swift Forums (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

This has been a major deficiency in many source document tools I've used. It'd be great if DocC can fill the gap!

Since Tim answered this question there has been some changes and I wanted to chime in with an updated answer.

You can document any symbols from private to public, the easiest way to set the minimum access levels to document is via the swift package command from the command line.

First you need to generate your module's symbol graph:

swift package dump-symbol-graph --minimum-access-level private

Then you copy the symbol graph to your doc bundle and run docc like usual from the command line:

docc convert MyDocs.docc
  • Ah, might have been a bit trigger happy here: this only works for SPM targets, not traditional Xcode targets, correct? That said, together with what Quinn referenced above, this should do the trick. I’ll give it a try when I’m back from my vacation.

Add a Comment

Hey @icanzilb, first of all thank for that answer, but if it is possible, I would like to ask you something. After being trying to make sense to what you said (I am a newbie) I ended up realising that your solution can only be applied to when building a package, right? it doesn't work in case of building an App and wanting to have an Apple style documentation where the rest of the developers could have access to not only the public symbols but also to the private ones, does it? However, if it works, could you please explain how to do it? Thanks a million :)

That flag, -symbol-graph-minimum-access-level private, works well in non-packages too. Added to XCode 14 Project settings  

  • Build Settings
    • Swift Compiler - Custom Flags

the Documentation window now shows all private members of a Framework target.

However …

My real goal is to have auto-completion and symbol links function within code comments. And they still do not. It’s as if the editor is using an internal version of .doccarchive that still has only public members of my Frameworks.

If I type `` or <doc: in a /// comment I only get suggestions for public members. And if I manually enter a private symbol, I only get the “?” for its documentation. It’s a dead link.

Any ideas on how I can have the editor see the same thing that Developer Documentation does?

It looks like the flag -symbol-graph-minimum-access-level private doesn't work with XCode 15.