Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.
Mattt edited this page Aug 2, 2020 · 8 revisions

Class

A class declaration.

public struct Class:​ Declaration, Hashable, Codable

Inheritance

Codable, CustomStringConvertible, Declaration, ExpressibleBySyntax, Hashable

Initializers

init(_:​)

Creates an instance initialized with the given syntax node.

public init(_ node:​ ClassDeclSyntax)

Properties

attributes

The declaration attributes.

let attributes:[Attribute]

modifiers

The declaration modifiers.

let modifiers:[Modifier]

keyword

The declaration keyword ("class").

let keyword:​ String

name

The class name.

let name:​ String

inheritance

A list of inherited type names.

let inheritance:[String]

If the class is a subclass, the first element is the superclass. Any other elements are names of protocols.

For example, given the following declarations, the inheritance of class C is ["B", "P"]:​

protocol P {}
class A {}
class B:​ A {}
class C:​ B, P {}

genericParameters

The generic parameters for the declaration.

let genericParameters:[GenericParameter]

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

class C<T:​ Equatable> {}

genericRequirements

The generic parameter requirements for the declaration.

let genericRequirements:[GenericRequirement]

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

class C<T> where T:​ Hashable {}

description

var description:​ String
Clone this wiki locally