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

Structure

Mattt edited this page Aug 2, 2020 · 7 revisions

Structure

A structure declaration.

public struct Structure:​ Declaration, Hashable, Codable

Inheritance

Codable, CustomStringConvertible, Declaration, ExpressibleBySyntax, Hashable

Initializers

init(_:​)

Creates an instance initialized with the given syntax node.

public init(_ node:​ StructDeclSyntax)

Properties

attributes

The declaration attributes.

let attributes:[Attribute]

modifiers

The declaration modifiers.

let modifiers:[Modifier]

keyword

The declaration keyword ("struct").

let keyword:​ String

name

The structure name.

let name:​ String

inheritance

A list of adopted protocols.

let inheritance:[String]

For example, given the following declarations, the inheritance of structure S is ["P", "Q"]:​

protocol P {}
protocol Q {}
struct S {}

genericParameters

The generic parameters for the declaration.

let genericParameters:[GenericParameter]

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

struct S<T:​ Equatable> {}

genericRequirements

The generic parameter requirements for the declaration.

let genericRequirements:[GenericRequirement]

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

struct S<T> where T:​ Hashable {}

description

var description:​ String
Clone this wiki locally