jazzy icon indicating copy to clipboard operation
jazzy copied to clipboard

Enums are not documented in my Swift code.

Open ollieatkinson opened this issue 9 years ago • 9 comments

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.

aspectratio enum reference safari today at 16 57 47

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.

ollieatkinson avatar Sep 21 '16 15:09 ollieatkinson

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.

fruitcoder avatar Oct 07 '16 09:10 fruitcoder

I will do some digging and come back with what I find.

istx25 avatar Nov 23 '16 23:11 istx25

The top comment isn't standard doc comment syntax. To document the enum members, you need to add doc comments to each.

jpsim avatar Nov 26 '16 06:11 jpsim

I'll hand off this issue to @jpsim. He knows more about the issue than I do. Cheers!

istx25 avatar Nov 26 '16 06:11 istx25

Ok, is this a bug in Xcode and it's documentation tooling then?

ollieatkinson avatar Nov 26 '16 10:11 ollieatkinson

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.

jpsim avatar Nov 26 '16 17:11 jpsim

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.

ollieatkinson avatar Nov 26 '16 17:11 ollieatkinson

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.

jpsim avatar Nov 26 '16 17:11 jpsim

@istx25 Everyone agrees here that this is a real bug, I think labels should be updated. Thanks!

zsstrehli avatar Apr 19 '17 10:04 zsstrehli

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.

johnfairh avatar Nov 04 '23 10:11 johnfairh