-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation style recommendations #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be a controversial change. Since we have a lot of code using the previous /** <docs> */
format, and Apple has been flip-flopping between the three styles - ///
, /** */
and /** */
(with *
for each line).
Is there a plan for how to migrate to ///
if this change is accepted?
Can we, somehow, mitigate Apple flip-flopping again?
How can we make sure there’s (enough) alignment in the guild around this?
I personally think following Xcode’s default is a good idea, but there’s the issue of our API docs getting diverging in style.
README.md
Outdated
or method and use `Cmd`-`/` to see this in action. Make sure to use the available markup tags like `@param`, | ||
`@return`, etc. (these will be auto-generated for you by Xcode). The `///` form is preferred for single line | ||
comments, and `/** */` for multi-line comments. Use the same formatting as in the example block above. | ||
or method and use `Option`+`Cmd`+`/` to see this in action. Make sure to use the available markup tags like `@param`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to mention the format we want. For those that aren’t using this specific version of Xcode, or Xcode at all. I.e. adding a mention like “Use ///
(three forward slashes) for single and multi-line comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually thought it would be easier to just follow the current Xcode format, whatever that is. I agree though, that it could be unclear for someone who's using another IDE. Do we know how many people are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, only one person is not using Xcode every now and then, so we can assume that everyone is using Xcode :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also recommend ///
specifically instead of the hotkey as I expect these to not be changed soon
BTW, the markups aren't @param
and such anymore. It's Parameter:
, Return:
and so on:
/// Description
///
/// - Parameters:
/// - withOperations: The array of content operations to use to display content.
/// - type: The desired type of the resulting `SPTHubViewController`.
///
/// - Returns: The resulting `SPTHubViewController` that's initialized as `type`.
I would also maybe recommend a styling approach to it (like a blank line between the sections like above) as I think the generated Xcode one doesn't do so and it looks a bit weird IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockbruno it is still @param
for ObjC.
There is no plan for migrating the old docs, AFAIK. I raised this question on guild meetings twice and the best suggestion I got was to make a PR with this change. So far, it seems to be a better way to start a discussion :) |
I think it's nice to recommend |
I'm very in favor of this change.
I'm open to give it a shot, would like seeing that happen too, but can't make promises. However, to me the greatest value of merging this is in writing documentation, not in reading it, so I wouldn't want to see mass-migration as a blocker for this.
I believe Xcode's plugin system should enable us to inject custom documentation templates, but I do not think it's worth the effort, and, to me at least, misses the point of aligning with the Xcode's default.
As @aniakorolova said, she'd already communicated that several times in the guild meetings. |
I’m satisfied with the answers @bubski provided for my overall questions. I do still think we should specific the style of comments we’d like to use though. If/when Apple changes their mind (again) on what |
I'm in favour of merging this, since most teams are using what Xcode provides by default. @aniakorolova Could you add a comment to make it explicit what the current Xcode formatting does and that if that changes we should update the guideline? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like people are pretty much in favour of this, so looks good to me as well.
I added the mentioning of edit: can't merge it actually, I don't have the write access. |
The new auto-generated Xcode docs use
///
for both single- and multi-line comments, so our recommendations are a little outdated.