Emiswelt
Emiswelt

Reputation: 4009

Auto-generate documentation templates for Swift code in XCode 7.2

Is it possible to auto-generate a documentation template for a given method in XCode?

Example of a documentation template:

///  
/// - parameter x: 
/// - parameter y: 
/// - parameter w: 
/// - parameter d: 
/// - returns: T

Corresponding to this method:

func subface(x: CGFloat, y: CGFloat, w: CGFloat, d: Int) -> UIImage{
    // ...
}

Upvotes: 2

Views: 972

Answers (2)

NhatQuang
NhatQuang

Reputation: 31

All you need is shortcut: command + option + /

Upvotes: 3

Hugo Alonso
Hugo Alonso

Reputation: 6824

Add VVDocumenter-Xcode via Alcatraz Package Manager.

this is an example after writing /// above the function definition.

     /**
     <#Description#>

     - parameter x: <#x description#>
     - parameter y: <#y description#>
     - parameter w: <#w description#>
     - parameter d: <#d description#>

     - returns: <#return value description#>
     */
    func subface(x: CGFloat, y: CGFloat, w: CGFloat, d: Int) -> UIImage{
       /*...*/
    }

The <# .. > marked sections are editable with just tapping over them.

Upvotes: 7

Related Questions