Xingou
Xingou

Reputation: 1181

How to use jazzy to document my swift project?

I want to document my swift project, and I find jazzy on the github. after a look at the guide, I create a new simple project and want to have a try, here is my ViewController with some document info:

import UIKit
/**
a view controller
*/
class ViewController: UIViewController {
// MARK: property
/// a simple var
var hello = 200

// MARK: Func
/// view did load
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    print(add(2, b: 2))
}
/// did receiveMemoryWarning
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

/// a document test func
func add(a:Int, b:Int)->Int{
    return a + b
    }
}

here is my command:

    ➜  DocumentDemo git:(master) ✗ jazzy --swift-version 2.1.1 \
--clean \
--author helloworld \
-x -scheme,DocumentDemo
Running xcodebuild
Parsing ViewController.swift (1/3)
Parsing AppDelegate.swift (2/3)
Parsing My.swift (3/3)
building site
jam out ♪♫ to your fresh new docs in `docs`
➜  DocumentDemo git:(master) ✗

and I expect the html to have some info about my view controller,but the result is nothing there:

enter image description here

I want to know how to use jazzy, hope some advices.

Upvotes: 3

Views: 4890

Answers (3)

Vinh Nguyen
Vinh Nguyen

Reputation: 826

Yes, if you just run jazzy, jazzy just assume you want default access control level is public.

So unless we annotate things with public, the final document won't show theses. Default level is internal.


Tip

You can create a .jazzy.yaml, and put configuration in there. So after this, can just run.

$ jazzy

Jazzy will parse our configured yaml file.

Reference: Siesta's jazzy

Upvotes: 1

Momo Id
Momo Id

Reputation: 31

On swift 3 just

jazzy --min-acl=internal

Upvotes: 3

Caleb Kleveter
Caleb Kleveter

Reputation: 11494

By default, Jazzy only documents public classes, functions, properties, etc. So you can do one of two things:

  1. Add the public keyword to classes, methods and properties you want document.
  2. Change the privacy level that Jazzy will document. You can change this with the --min-acl flag:

    jazzy --swift-version 2.1.1 --min-acl=internal
    

Upvotes: 5

Related Questions