SwiftSemantics Documentation Beta

Structure Enumeration

public struct Enumeration: Declaration, Hashable, Codable

An enumeration declaration.

%3 Enumeration Enumeration CustomStringConvertible CustomStringConvertible Enumeration->CustomStringConvertible ExpressibleBySyntax ExpressibleBySyntax Enumeration->ExpressibleBySyntax Codable Codable Enumeration->Codable Declaration Declaration Enumeration->Declaration Hashable Hashable Enumeration->Hashable

Nested Types

Enumeration.Case

An enumeration case.

Conforms To

Declaration

A Swift declaration.

ExpressibleBySyntax

A type that can be initialized with a Swift syntax node.

Codable
CustomStringConvertible
Hashable

Initializers

init(_:​)

public init(_ node: EnumDeclSyntax)

Creates an instance initialized with the given syntax node.

Properties

attributes

let attributes: [Attribute]

The enumeration declaration attributes.

modifiers

let modifiers: [Modifier]

The enumeration declaration modifiers.

keyword

let keyword: String

The enumeration declaration keyword (enum).

name

let name: String

The name of the enumeration.

inheritance

let inheritance: [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 {}

generic​Parameters

let genericParameters: [GenericParameter]

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> {}

generic​Requirements

let genericRequirements: [GenericRequirement]

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 {}

description

var description: String