Skip to content

WitnessTable

tevelee edited this page Jul 21, 2026 · 2 revisions

WitnessTable

In its simpliest form, a witness table is simply a table of function pointers that fulfill the requirements a protocol imposes. Witness tables instruct exactly how a type conforms to a protocol and the functions needed to satisy a protocol requirement.

public struct WitnessTable: LayoutWrapper 

ABI Stability: Stable since the following

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

Inheritance

LayoutWrapper

Initializers

init(ptr:)

Initializes a witness table from a raw pointer.

public init(ptr: UnsafeRawPointer) 

Parameters

  • ptr: A pointer to the witness table's memory layout.

Properties

ptr

The raw pointer to the witness table in memory.

public let ptr: UnsafeRawPointer

conformanceDescriptor

The conformance descriptor that describes the protocol conformance relationship for whatever type this witness table is representing, and the protocol that type conforms to.

public var conformanceDescriptor: ConformanceDescriptor 
Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally