Protocol

public struct Protocol : Declaration, Hashable, Codable
extension Protocol: ExpressibleBySyntax
extension Protocol: CustomStringConvertible

A protocol declaration.

  • The declaration attributes.

    Declaration

    Swift

    public let attributes: [Attribute]
  • The declaration modifiers.

    Declaration

    Swift

    public let modifiers: [Modifier]
  • The declaration keyword ("protocol").

    Declaration

    Swift

    public let keyword: String
  • The protocol name.

    Declaration

    Swift

    public let name: String
  • A list of adopted protocols.

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

    protocol Q {}
    protocol P: Q {}
    

    Declaration

    Swift

    public let inheritance: [String]

ExpressibleBySyntax

  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    public init(_ node: ProtocolDeclSyntax)

CustomStringConvertible

  • Declaration

    Swift

    public var description: String { get }