How to generate HTML documentation for SWIFT files in Xcode with HeaderDoc?

ottorottok picture ottorottok · Sep 26, 2014 · Viewed 10.1k times · Source

I tried to document my Swift project in Xcode with HeaderDoc, but are processed only files ".h" and are ignored files ".swift"

This is my swift File:

/// test
///
/// :param: ann blabla
func testFunc( ann: Foo ) { .. }

I run the following in the Terminal:

headerdoc2html -o ~/Desktop/docum Ninja

This is the error:

    Documentation will be written to /Users/me/Desktop/docum
    HTML output mode.
    No valid input files specified. 

        Usage: headerdoc2html [-dq] [-o <output directory>] <input file(s) or directory>.

    iMac:MyApp me$  headerdoc2html -o ~/Desktop/docum Ninja/

    Documentation will be written to /Users/me/Desktop/docum
    HTML output mode.
    DIR Ninja/
    ======= Parsing Input Files =======

    Processing Ninja/Test.m
        Skipping. No HeaderDoc comments found.

    Processing Ninja/-Bridging-Header.h

Answer

zrubenst picture zrubenst · Oct 11, 2014

Yeah...

As of right now, HeaderDoc cannot convert Swift inline-documentation into HTML files using headerdoc2html. You, and everyone (myself included) will sadly have to wait.


Other options

So the 'big three' iOS code documentation tools are HeaderDoc, AppleDoc, and Doxygen. Sadly, all three do not support Swift. Good news: AppleDoc is coming out with v3.0 relatively soon and the other two may (probably will) also update as well. AppleDoc is open source, so if you are code savvy, you could adapt it to fit your needs (with swift and all that jazz)

EDIT:

I commented on AppleDoc's Github page and got a couple replies. Mainly, on October 16, 2014 apple is having a conference. After this conference, the AppleDoc guys (gals?) will begin adding Swift support to AppleDoc 3.0 and it will be released at some point.


Speaking of Jazz

Jazzy is something out right now (!) and can generate documentation in the form of HTML for Swift (!!) I had a hard time setting it up, and it's format is unorthodox, but if you can't wait for the big three to update, it may just be for you.

good luck with your adventure.

ZR