Skip to content

ProtocolDescriptor

tevelee edited this page Jul 25, 2026 · 3 revisions

ProtocolDescriptor

A protocol descriptor that describes some protocol context.

public struct ProtocolDescriptor: ContextDescriptor, LayoutWrapper 

ABI Stability: Stable since the following

| macOS | iOS/tvOS | watchOS | Linux | Windows |
|-------|----------|---------|-------|---------|
| 10.14 | 12.2     | 5.2     | NA    | NA      |

Inheritance

ContextDescriptor, LayoutWrapper

Properties

ptr

Backing context descriptor pointer.

public let ptr: UnsafeRawPointer

protocolFlags

The specific flags that describe a protocol descriptor.

public var protocolFlags: Flags 

name

The name of this protocol.

public var name: String 

numRequirementsInSignature

The number of generic requirements in this protocol's signature.

public var numRequirementsInSignature: Int 

numRequirements

The number of protocol requirements this protocol defines.

public var numRequirements: Int 

associatedTypeNames

A string of all associatedtype names.

public var associatedTypeNames: String 

requirementSignature

An array of all the generic requirements in this protocol's signature.

public var requirementSignature: [GenericRequirementDescriptor] 

requirements

An array of all the protocol requirements this protocol defines.

public var requirements: [ProtocolRequirement] 

associatedTypeNameList

The names of this protocol's associated types in declaration order.

public var associatedTypeNameList: [String] 

Methods

associatedTypeWitness(named:conformingType:witnessTable:)

Resolves the metadata bound to an associated type for a conformance.

public func associatedTypeWitness(
    named name: String,
    conformingType: Metadata,
    witnessTable: WitnessTable
  ) -> Metadata? 

Parameters

  • name: The associated type name, such as "Element".
  • conformingType: Metadata for the conforming type.
  • witnessTable: The conformance's witness table.

Returns

The associated type's metadata, or nil if this descriptor does not define name or the required witness is unavailable.

Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally