Enumeration

public struct Enumeration : Declaration, Hashable, Codable
extension Enumeration: CustomStringConvertible
extension Enumeration: ExpressibleBySyntax

An enumeration declaration.

  • A dot-delimited (.) path used to qualify the enumeration name within the module scope of the declaration, or nil if the enumeration isn’t nested (that is, declared at the top-level scope of a module).

    For example, given the following declaration of an enumeration C, the context is "A.B":

    enum A { enum B { enum C {} }
    

    Declaration

    Swift

    public let context: String?
  • The enumeration declaration attributes.

    Declaration

    Swift

    public let attributes: [Attribute]
  • The enumeration declaration modifiers.

    Declaration

    Swift

    public let modifiers: [Modifier]
  • The enumeration declaration keyword (enum).

    Declaration

    Swift

    public let keyword: String
  • The name of the enumeration.

    Declaration

    Swift

    public let name: String
  • A list of inherited type names.

    If the enumeration is raw representable, the first element is the raw value type. Any other elements are names of protocols.

    For example, given the following declarations, the inheritance of enumeration E is ["Int", "P"]:

    protocol P {}
    enum E: Int, P {}
    

    Declaration

    Swift

    public let inheritance: [String]
  • The generic parameters for the declaration.

    For example, the following declaration of enumeration E has a single generic parameter whose name is "T" and type is "Equatable":

    enum E<T: Equatable> {}
    

    Declaration

    Swift

    public let genericParameters: [GenericParameter]
  • The generic parameter requirements for the declaration.

    For example, the following declaration of enumeration E has a single requirement that its generic parameter identified as "T" conforms to the type identified as "Hahable":

    enum E<T> where T: Hashable {}
    

    Declaration

    Swift

    public let genericRequirements: [GenericRequirement]
  • An enumeration case.

    See more

    Declaration

    Swift

    public struct Case : Declaration, Hashable, Codable
    extension Enumeration.Case: CustomStringConvertible

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }

ExpressibleBySyntax

  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    public init(_ node: EnumDeclSyntax)