Case

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

An enumeration case.

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

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

    enum A { enum B { enum C { case c } }
    

    Declaration

    Swift

    public let context: String?
  • The declaration attributes.

    Declaration

    Swift

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

    Declaration

    Swift

    public let modifiers: [Modifier]
  • The declaration keyword ("case").

    Declaration

    Swift

    public let keyword: String
  • The enumeration case name.

    Declaration

    Swift

    public let name: String
  • The associated values of the enumeration case, if any.

    Declaration

    Swift

    public let associatedValue: [Function.Parameter]?
  • The raw value of the enumeration case, if any.

    Declaration

    Swift

    public let rawValue: String?

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }

ExpressibleBySyntax

  • Creates and returns enumeration cases from an enumeration case declaration.

    Declaration

    Swift

    public static func cases(from node: EnumCaseDeclSyntax) -> [Enumeration.Case]
  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    @available(swift, introduced: 0.0.1, deprecated: 0.0.1, message: "Use Enumeration.Case.cases(from:﹚ instead")
    public init(_ node: EnumCaseDeclSyntax)