Skip to content

ExistentialMetadata

tevelee edited this page Jul 25, 2026 · 2 revisions

ExistentialMetadata

The metadata structure that represents some existential type, mainly protocols, in Swift.

public struct ExistentialMetadata: Metadata, LayoutWrapper 

ABI Stability: Unstable across all platforms

| macOS | iOS/tvOS | watchOS | Linux | Windows |
|-------|----------|---------|-------|---------|
| NA    | NA       | NA      | NA    | NA      |

Inheritance

Metadata, LayoutWrapper

Properties

ptr

Backing existential metadata pointer.

public let ptr: UnsafeRawPointer

flags

The flags specific to existential metadata.

public var flags: Flags 

numProtocols

The number of protocols that compose this existential type.

public var numProtocols: Int 

superclass

The superclass type that this existential is constrained to, if any.

public var superclass: Any.Type? 

superclassMetadata

The superclass metadata that this existential is constrained to, if any.

public var superclassMetadata: Metadata? 

protocolReferences

An array of protocol references that make up this existential.

public var protocolReferences: [ExistentialProtocolReference] 

Swift stores both native Swift protocol descriptors and Objective-C protocol objects in this trailing array. protocolReferences preserves that discriminator, so it is safe for existentials such as any NSObjectProtocol as well as ordinary Swift protocol compositions.

protocols

Native Swift protocol descriptors that make up this existential.

public var protocols: [ProtocolDescriptor] 

This compatibility projection intentionally omits Objective-C protocol references. Use protocolReferences when the existential may include Objective-C protocols.

Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally