Enums are not documented in my Swift code.
I have the following enum:
/// The aspect ratio of the image.
///
/// - wide: 16:9 aspect ratio.
/// - standard: 4:3 aspect ratio.
public enum AspectRatio {
case wide
case standard
}
However when I generate the documentation for this each of the cases are marked as undocumented - I am guessing I have the syntax wrong (I used the default apple documentation in Xcode 8) or jazzy is not correctly picking up the case statements.
I would greatly appreciate any pointers on this, it is not a blocker and causing any technical problems but just that total documentation % is getting lower with the enums not being present.
Thanks.
Currently I copy over what I have in the enum description for the specific cases.
/// The aspect ratio of the image.
///
/// - wide: 16:9 aspect ratio.
/// - standard: 4:3 aspect ratio.
public enum AspectRatio {
/// 16:9 aspect ratio.
case wide
/// 4:3 aspect ratio.
case standard
}
While I agree that this could be automatically parsed and added to the documentation with jazzy, XCode would still not give you a description when you just alt-click on a specific case. That's why I decided to duplicate the information.
I will do some digging and come back with what I find.
The top comment isn't standard doc comment syntax. To document the enum members, you need to add doc comments to each.
I'll hand off this issue to @jpsim. He knows more about the issue than I do. Cheers!
Ok, is this a bug in Xcode and it's documentation tooling then?
What makes you think this is a bug anywhere? You're using syntax that isn't documented anywhere as a valid way to document enums and their members.
To clarify this documentation is automatically generated by Xcode when you press CMD + alt + / above the enum. I use it to document functions, variables etc too.
I see. Ok, that does change things. Thanks for clarifying that. Jazzy could certainly use that documentation if the individual members don't have doc comments.
@istx25 Everyone agrees here that this is a real bug, I think labels should be updated. Thanks!
This was always a bit of an Apple mixup because their docs tools never understood the doc-comment format that Xcode generated. In Xcode 15 (and possibly earlier, maybe when DocC tools started to be used to generate Xcode Quick Help) the Xcode generate-documentation action for enums no longer adds the cases to the enum description. So I'm going to close this now.