Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Enumeration

Mattt edited this page Aug 2, 2020 · 8 revisions

Enumeration

An enumeration declaration.

public struct Enumeration:​ Declaration, Hashable, Codable

Inheritance

Codable, CustomStringConvertible, Declaration, ExpressibleBySyntax, Hashable

Initializers

init(_:​)

Creates an instance initialized with the given syntax node.

public init(_ node:​ EnumDeclSyntax)

Properties

attributes

The enumeration declaration attributes.

let attributes:[Attribute]

modifiers

The enumeration declaration modifiers.

let modifiers:[Modifier]

keyword

The enumeration declaration keyword (enum).

let keyword:​ String

name

The name of the enumeration.

let name:​ String

inheritance

A list of inherited type names.

let inheritance:[String]

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

genericParameters

The generic parameters for the declaration.

let genericParameters:[GenericParameter]

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

genericRequirements

The generic parameter requirements for the declaration.

let genericRequirements:[GenericRequirement]

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
Clone this wiki locally