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

Protocol

mattt edited this page Jan 26, 2020 · 7 revisions

Protocol

A protocol declaration.

public struct Protocol: Declaration, Hashable, Codable

Declaration, Hashable, Codable, CustomStringConvertible, ExpressibleBySyntax

Initializers

init(_:)

Creates an instance initialized with the given syntax node.

public init(_ node: ProtocolDeclSyntax)

Properties

attributes

The declaration attributes.

let attributes: [Attribute]

modifiers

The declaration modifiers.

let modifiers: [Modifier]

keyword

The declaration keyword ("protocol").

let keyword: String

name

The protocol name.

let name: String

inheritance

A list of adopted protocols.

let inheritance: [String]

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

protocol Q {}
protocol P: Q {}

description

var description: String