1

I'm following this answer to document my classes in swift. My question is: is there a way to create the documentation of methods automatically inside xcode? I mean, just as you to in php strom when you just type /** + enter, or /// + enter in visual studio.

Community
  • 1
  • 1
André Luiz
  • 6,642
  • 9
  • 55
  • 105

2 Answers2

1

Yes - in Xcode this is called Quick Help documentation.

You can automatically generate the documentation stub by putting your cursor inside the method or class name, and pressing cmd+option+/.

Craig Brown
  • 1,891
  • 1
  • 24
  • 25
0

Do you mean like this?

/// Returns the sum of four values
///
///
/// - Parameters:
///     - a: Value 1
///     - b: Value 2
///     - c: Value 3
///     - d: Value 4
func calculate(a: Double, b: Double, c: Double, d: Double) -> Double {
    return a + b + c + d
}

Which will return: enter image description here

Rashwan L
  • 38,237
  • 7
  • 103
  • 107