How to add documentation to enum associated values in Swift

后端 未结 1 1989
盖世英雄少女心
盖世英雄少女心 2021-01-07 20:41

Is there a way to add descriptions to associated values of enums in Swift 3? I want them to show up in the symbol documentation popup (option+click), like they do for functi

相关标签:
1条回答
  • 2021-01-07 21:11

    Do it like this:

    /// Enum Description
    enum Enum {
        /// enum1 Description
        /// - value1: value1 Description
        /// - value2: value2 Description
        case enum1(value1: Int, value2: String)
    
        /// enum2 Description
        case enum2
    }
    

    Show result:

    0 讨论(0)
提交回复
热议问题