-
Notifications
You must be signed in to change notification settings - Fork 0
TypeMetadata
Type metadata refers to those metadata records who declare a new type in Swift. Said metadata records only refer to structs, classes, and enums.
public protocol TypeMetadata: Metadata ABI Stability: Stable since the following
| macOS | iOS/tvOS | watchOS | Linux | Windows |
|-------|----------|---------|-------|---------|
| 10.14 | 12.2 | 5.2 | NA | NA |
The list of conformances defined for this type metadata.
public var conformances: [ConformanceDescriptor] NOTE: This list is populated once before the program starts with all of the conformances that are statically know at compile time. If you are attempting to load libraries dynamically at runtime, this list will update automatically, so make sure if you need up to date information on a type's conformances, fetch this often. Example:
let metadata = ...
var conformances = metadata.conformances
loadPlugin(...)
// conformances is now outdated! Refresh it by calling this again.
conformances = metadata.conformances
The base type context descriptor for this type metadata record.
public var contextDescriptor: TypeContextDescriptor? An array of field offsets for this type's stored representation.
public var fieldOffsets: [Int] The generic argument layout for this type.
public var genericArguments: [GenericArgument] The result includes pack lengths, metadata packs, witness-table packs, and value arguments when the context uses them. Unknown future argument forms fail closed as an empty result instead of being reinterpreted as a metatype.
The ordinary type arguments for a type-only generic context.
public var genericTypes: [Any.Type] This compatibility convenience deliberately returns an empty array for
packs, values, non-key parameters, or unknown layouts. Use
genericArguments for all modern generic contexts.
An array of metadata records for the types that represent the generic arguments that make up this type.
public var genericMetadata: [Metadata] Given a mangled type name to some field, superclass, etc., return the type. Using this is the preferred way to interact with mangled type names because this uses the metadata's generic context and arguments and such to fill in generic types along with caching the mangled name for future use.
public func type(
of mangledName: UnsafeRawPointer
) -> Any.Type? - mangledName: The mangled type name pointer to some type in this metadata's reach.
The type that the mangled type name refers to, if we're able to demangle it.
Resolves an associated type from this type's conformance to a protocol.
public func associatedType(
named name: String,
conformingTo protocolDescriptor: ProtocolDescriptor
) -> Metadata? - name: The associated type name, such as
"Element". - protocolDescriptor: The protocol declaring the associated type.
The associated type's metadata, or nil when this type does not conform to that protocol or the protocol has no matching name.
Generated at 2026-07-27T11:49:06+0000 using swift-doc 1.0.0-rc.1.
Types
- AccessibleFunction
- AccessibleFunctionFlags
- AnonymousDescriptor
- AnonymousDescriptor.Flags
- AnyExistentialContainer
- AsyncContinuationFlags
- BoxPair
- ClassDescriptor
- ClassMetadata
- ClassMetadata.Flags
- ConformanceDescriptor
- ConformanceDescriptor.Flags
- ContextDescriptorFlags
- ContextDescriptorKind
- ContinuationStatus
- CoroutineAllocator
- CoroutineAllocatorFlags
- CoroutineAllocatorKind
- DefaultOverrideTableHeader
- DualExistentialContainer
- DynamicCastFlags
- DynamicReplacementChainEntry
- DynamicReplacementDescriptor
- DynamicReplacementKey
- DynamicReplacementScope
- EnumDescriptor
- EnumMetadata
- EnumValueWitnessTable
- ExistentialContainer
- ExistentialMetadata
- ExistentialMetadata.Flags
- ExistentialProtocolReference
- ExistentialProtocolReference.Kind
- ExtendedExistentialMetadata
- ExtendedExistentialTypeShape
- ExtendedExistentialTypeShape.Flags
- ExtendedExistentialTypeShape.SpecialKind
- ExtendedFunctionTypeFlags
- ExtensionDescriptor
- ExtraClassDescriptorFlags
- FieldDescriptor
- FieldDescriptor.Kind
- FieldRecord
- FieldRecord.Flags
- FixedArrayMetadata
- ForeignClassMetadata
- ForeignMetadataInitialization
- ForeignReferenceTypeMetadata
- FunctionConvention
- FunctionMetadata
- FunctionMetadata.DifferentiabilityKind
- FunctionMetadata.Flags
- FunctionMetadata.ParamFlags
- GenericArgument
- GenericClassMetadataPattern
- GenericContext
- GenericContextDescriptorFlags
- GenericEnvironment
- GenericEnvironmentFlags
- GenericMetadataPartialPattern
- GenericMetadataPattern
- GenericMetadataPattern.Flags
- GenericPackKind
- GenericPackShapeDescriptor
- GenericPackShapeHeader
- GenericParameterDescriptor
- GenericParameterKind
- GenericRequirementDescriptor
- GenericRequirementDescriptor.Flags
- GenericRequirementKind
- GenericRequirementLayoutKind
- GenericSignatureHeader
- GenericValueDescriptor
- GenericValueHeader
- GenericValueMetadataPattern
- GenericValueType
- GenericWitnessTable
- GlobalActorReference
- HeapGenericLocalVariableMetadata
- HeapLocalVariableMetadata
- HeapObject
- InvertibleProtocolKind
- InvertibleProtocolSet
- JobFlags
- JobKind
- JobPriority
- KeyPathComponentHeader
- KeyPathComponentHeader.ComputedIdentifierKind
- KeyPathComponentHeader.ComputedIdentifierResolution
- KeyPathComponentHeader.ComputedPropertyKind
- KeyPathComponentHeader.Kind
- KeyPathComponentHeader.OptionalOperation
- KeyPathComponentHeader.StoredOffsetKind
- KnownMetadata
- KnownMetadata.Builtin
- MetadataAccessFunction
- MetadataBounds
- MetadataInitializationKind
- MetadataKind
- MetadataPack
- MetadataRequest
- MetadataResponse
- MetadataState
- MetadataTrailingFlags
- MetatypeMetadata
- MethodDefaultOverrideDescriptor
- MethodDescriptor
- MethodDescriptor.Flags
- MethodDescriptor.Kind
- MethodOverrideDescriptor
- ModuleDescriptor
- NonUniqueExtendedExistentialTypeShape
- ObjCClassWrapperMetadata
- OpaqueDescriptor
- OpaqueMetadata
- OpaqueTypeReplacement
- OverrideTableHeader
- PackLifetime
- ProtocolDescriptor
- ProtocolDescriptor.Flags
- ProtocolDispatchStrategy
- ProtocolRequirement
- ProtocolRequirement.Flags
- ProtocolRequirement.Kind
- ReferenceStorageKind
- RelativeWitnessTable
- ResilientClassMetadataPattern
- ResilientWitness
- SerialExecutorReference
- SerialExecutorReference.Kind
- SingletonMetadataInitialization
- SpecialProtocol
- StructDescriptor
- StructMetadata
- TaskCreateFlags
- TaskExecutorReference
- TaskExecutorReference.Kind
- TaskGroupFlags
- TaskOptionRecordFlags
- TaskOptionRecordKind
- TaskStatusRecordFlags
- TaskStatusRecordKind
- TupleMetadata
- TupleMetadata.Element
- TypeContextDescriptorFlags
- TypeGenericContext
- TypeImportInfo
- TypeReferenceKind
- UnknownMetadata
- VTableDescriptorHeader
- ValueOwnership
- ValueWitnessTable
- ValueWitnessTable.Flags
- WitnessTable
- WitnessTablePack
Global Typealiases
Global Variables
Global Functions
- container(for:)
- findConformance(to:)
- findConformance(toProtocolNamed:)
- lookupSection(_:segment:section:do:)
- reflect(_:)
- reflectClass(_:)
- reflectEnum(_:)
- reflectStruct(_:)
- registerAccessibleFunctions(section:size:)
- registerDynamicReplacementScopes(section:size:)
- registerOpaqueTypeReplacements(section:size:)
- registerProtocolConformances(section:size:)
- registerProtocols(section:size:)
- registerTypeMetadata(section:size:)
- swift_allocBox(for:)
- swift_allocObject(for:size:alignment:)
- swift_conformsToProtocol(metadata:protocol:)
- swift_conformsToProtocol(type:protocol:)
- swift_getTypeName(for:qualified:)
- withProjectedValue(of:_:)
- withProjectedValues(of:_:)