swiftxcodedocumentationapple-documentation

Xcode - Add Custom Documentation for Swift Closure


Question:

Example:

struct S1 {

    /// This block is executed after completion
    var completion : (String, Int) -> (Bool)
}

Note:

Xcode 8 has built in functionality to add documentation to custom code.

This can be done, by doing one of the following:


Solution

  • Reference:

    Workaround:

    If those tags are not supported for the given location the only possible workaround seems to be right now:

    struct S1 {
        
        /// description
        ///
        /// __returns__
        /// blah blah
        ///
        /// __parameters__
        /// blah blah
        var completion : (String, Int) -> (Bool)
    }