简体   繁体   English

如何使用jazzy来记录我的快速项目?

[英]How to use jazzy to document my swift project?

I want to document my swift project, and I find jazzy on the github. 我想记录我的快速项目,我在github上找到jazzy。 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: 看完指南后,我创建了一个新的简单项目,想要试试,这里是我的ViewController带有一些文档信息:

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: 我希望html有关于我的视图控制器的一些信息,但结果是什么没有:

在此输入图像描述

I want to know how to use jazzy, hope some advices. 我想知道如何使用爵士,希望一些建议。

By default, Jazzy only documents public classes, functions, properties, etc. So you can do one of two things: 默认情况下,Jazzy只记录public类,函数,属性等。因此,您可以执行以下两项操作之一:

  1. Add the public keyword to classes, methods and properties you want document. public关键字添加到您想要文档的类,方法和属性。
  2. Change the privacy level that Jazzy will document. 更改 Jazzy将记录的隐私级别 You can change this with the --min-acl flag: 您可以使用--min-acl标志更改此设置:

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

在swift 3上

jazzy --min-acl=internal

Yes, if you just run jazzy , jazzy just assume you want default access control level is public . 是的,如果你只是运行jazzy ,jazzy只是假设你想要默认的访问控制级别是public

So unless we annotate things with public , the final document won't show theses. 因此,除非我们用public注释事物,否则最终文件将不会显示这些内容。 Default level is internal . 默认级别是internal


Tip 小费

You can create a .jazzy.yaml , and put configuration in there. 您可以创建.jazzy.yaml ,并在其中放置配置。 So after this, can just run. 所以在此之后,可以运行。

$ jazzy

Jazzy will parse our configured yaml file. Jazzy将解析我们配置的yaml文件。

Reference: Siesta's jazzy 参考: Siesta的爵士乐

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM