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

Protocol

mattt edited this page Mar 28, 2020 · 7 revisions

Protocol

A protocol declaration.

public struct Protocol: Declaration, Hashable, Codable

Inheritance

Codable, Hashable, Declaration

Initializers

init(_:)

Creates an instance initialized with the given syntax node.

public init(_ node: ProtocolDeclSyntax)

Properties

description

var description: String

keyword

The declaration keyword ("protocol").

let keyword: String

name

The protocol name.

let name: String

modifiers

The declaration modifiers.

let modifiers: [Modifier]

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

attributes

The declaration attributes.

let attributes: [Attribute]