[英]Swift documentation comment @code equivalent.
我知道Swift文檔注釋及其許多用於記錄代碼的標記,例如:param:,:return:等。
但是我無法找到或找出等效於Swift的@code Objective-C文檔注釋。 我想在我的開源項目的某個類的描述中包含一些代碼示例,但是我不確定該怎么做。
誰能在此階段闡明如何做到這一點,或者甚至可以做到這一點?
使用appledoc ,您只需縮進代碼4個空格
/*!
Documentation for the class.
Here is a code sample
func code()
{
//code
}
*/
你會發現,一個lot
的 格式選項類似於堆棧溢出! 他們都使用Markdown進行格式化。
我剛巧第一次用appledoc記錄了一個項目,所以我有最近歷史的一些頁面。 code
功能記錄在這里
關於有關:code: @code
語法選項的問題。 Appledoc指令接受任何非空格字符后跟關鍵字。 對Xcode而言,文檔化只是一個注釋 。
指令前綴:盡管以上示例中的所有指令都使用“ @”符號作為前綴,但實際上您可以使用任何非空格字符代替,例如\\ param,$ param,%param等。
但是,看起來像Appledoc並不支持通用@code
,而其他文檔工具(如doxygen )卻不支持。
按照此處的參考,您可以按照以下內容編寫代碼塊的文檔。
/**
The area of the `Shape` instance.
Computation depends on the shape of the instance. For a triangle, `area` will be equivalent to:
let height = triangle.calculateHeight()
let area = triangle.base * height / 2
*/
var area: CGFloat { get }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.