How to use Swift documentation comments

后端 未结 5 1240
你的背包
你的背包 2021-01-30 01:10

I have a few questions about Swift documentation comments:

  1. Is there a way to make a Related declarations section like some of the Apple documentation has? For e

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-30 01:27

    For those who want to add this as code snippet. Swift 5, XCode 11.3+

    This is an add on to : Yogendra Singh's Answer in this thread

    /**
    <#Summay text for documentation#>
    
    - parameter <#parameterName#>: <#Description#>.
    - returns: <#Return values#>
    - warning: <#Warning if any#>
    
    
     # Notes: #
     1. <#Notes if any#>
    
     # Example #
    ```
     // <#Example code if any#>
    ```
    
    */
    

    Copy and paste the above code in Xcode. Select the code and then Right click.

    Save the code snippet and give the completion name as documentation.

    Now if we start typing documentation, the snippet will be shown in the code completion.

提交回复
热议问题