swiftdocc

Swift Doc-C - Selective data for documentation


Is it possible to select specific classes or structs for documentation ? As of now when I hosted my static website using doc-c command line it pulled up all the public methods for the sake of documentation. Is it possible that I can select what folders within my code needs to be pulled up for documentation purpose ? Any link , video, example will be highly appreciated

Thanks in advance


Solution

  • DocC will use symbol graph data from compilers like swiftc and clang.

    By default, compiler will generate it from all public symbols. And we can config it to internal when generating documentation for an app.

    TL,DR:

    If you do not want your public symbol to be documented. You can use @_documentation(visibility: private)

    For the full context, you can check the following forums posts and Swift documentation for Underscored Attributes.

    https://forums.swift.org/t/nodoc-attribute-for-hiding-symbols-from-the-symbol-graph/59227

    https://github.com/apple/swift/blob/main/docs/ReferenceGuides/UnderscoredAttributes.md#_documentationvisibility-