Skip to content

GenericContext

tevelee edited this page Jul 25, 2026 · 3 revisions

GenericContext

A generic context describes the generic information about some generic context.

public struct GenericContext: LayoutWrapper 

ABI Stability: Stable since the following

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

Inheritance

LayoutWrapper

Properties

numParams

The number of generic parameters this context has.

public var numParams: Int 

numRequirements

The number of generic requirements this context has.

public var numRequirements: Int 

numKeyArguments

The number of "key" generic parameters this context has.

public var numKeyArguments: Int 

numExtraArguments

The number of "extra" generic parameters this context has.

public var numExtraArguments: Int 

This value is always zero in current Swift ABIs. The storage formerly used for it now holds descriptorFlags.

parameters

An array of all the generic parameters this context has.

public var parameters: [GenericParameterDescriptor] 

requirements

An array of all the generic requirements this context has.

public var requirements: [GenericRequirementDescriptor] 

size

Number of bytes this generic context is.

public var size: Int 

descriptorFlags

Flags describing the trailing records carried by this generic context.

public var descriptorFlags: GenericContextDescriptorFlags 

packShapeHeader

The pack-shape header for a variadic-generic context, if present.

public var packShapeHeader: GenericPackShapeHeader? 

packShapeDescriptors

Shape descriptors for each metadata or witness-table pack in this context. The ABI records one descriptor per pack, not per shape class.

public var packShapeDescriptors: [GenericPackShapeDescriptor] 

conditionalInvertedProtocols

The protocols with conditional requirements in this generic context.

public var conditionalInvertedProtocols: InvertibleProtocolSet? 

The presence of this record is controlled by descriptorFlags.hasConditionalInvertedProtocols. The individual requirement counts are cumulative and are available through conditionalInvertedProtocolRequirementCounts.

conditionalInvertedProtocolRequirementCounts

Cumulative requirement counts for each conditional inverted protocol.

public var conditionalInvertedProtocolRequirementCounts: [UInt16] 

An empty array is returned when no conditional inverted-protocol record is present or its cumulative counts are invalid.

conditionalInvertedProtocolRequirements

Requirements associated with conditionalInvertedProtocols.

public var conditionalInvertedProtocolRequirements: [GenericRequirementDescriptor] 

The final cumulative count determines the number of records. Invalid cumulative counts are treated as no readable trailing requirements.

genericValueHeader

The header for value generic parameters, if the context contains them.

public var genericValueHeader: GenericValueHeader? 

genericValueDescriptors

Descriptors for value generic parameters.

public var genericValueDescriptors: [GenericValueDescriptor] 
Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally