Why Xcode cmd-option-/ generate doc comment use parameter name instead of label for parameter documentation?

/// Description
/// - Parameter name: why Xcode use name instead of label?
func blahblah(label name: Int)  { }

Documentation helps caller to understand what the function does, shouldn't it use label instead of name? label is used by the caller, name is used internal to the function.

1 Like
  1. It's not unusual for parameters to omit argument labels; using _ for the internal parameter name is possible but not as common.
  2. Not only _ but also explicit labels can be repeated and therefore do not necessarily uniquely identify which parameter is being referred to.
  3. Based on Swift naming guidelines, many labels are prepositions like "for," "of," "into," which are less descriptive than the internal parameter names.
5 Likes

Ah ha, this make sense!

TIL! Although I haven't seen this "in the wild"