Swift standard documentation comment

前端 未结 5 1315
小鲜肉
小鲜肉 2020-12-31 06:18

Is there a standard way to write documentation comment in the Swift language? Something equivalent to javadoc (Java) or docstrings (Python)?

example:



        
5条回答
  •  梦毁少年i
    2020-12-31 06:36

    EDIT: This solution doesn't work with Swift 2.0.

    OLDER solution work until swift 1.2:
    I am now trying out the swift language and documentation tool. The Xcode is very sensitive to indent the text. The keywords must start at the same place. The keywords must insert beetwen colon, example ":returns:" If the xcode is not recognized the keyword, then Xcode puts the text into the description.

    From this:

        /**
        Keresés után le lehet kérdezni egy konkrét találatot, pl. ha a harmadikra vagyunk mondjuk kíváncsiak.
    
        :note: n-1 legyen az \p index értéke, mert tömb révén a 0. elemmel keződik a tömb.
        :param: aSearchName Keresés meghatározásánál megadott név.
        :returns:               Konkrét találat. Ha nincs találat, akkor üres stringgel tér vissza a függvégy.
        :pre:               `aSearchName` != nil && !\p aSearchName != ""
        */
    

    it will be:

    enter image description here

提交回复
热议问题