1

Question:

  • What is the correct format to add documentation (using built in functionality not 3rd party) to a custom Swift closure in Xcode 8 ?
  • Could you provide the Apple documentation link to refer ?
  • How to specify the closure parameters ?
  • How to specify the closure return type ?

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:

  • Command + Option + Click on code

  • Keep cursor on code and Editor > Structure > Add documentation

1 Answer 1

1

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)
}
Sign up to request clarification or add additional context in comments.

2 Comments

The parameter and return type are not showing up. Only the description shows up for Swift Code.
ahh ok, now I understand the question! Added a paragraph to my answer. Sadly thats not going to change with Xcode9.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.