Skip to content

withProjectedValues(of___)

tevelee edited this page Jul 27, 2026 · 1 revision

withProjectedValues(of:_:)

Projects erased values' dynamic types and initialized storage for the duration of body.

public func withProjectedValues<Result>(
  of instances: [Any],
  _ body: ([(type: Any.Type, storage: UnsafeRawPointer)]) throws -> Result
) rethrows -> Result 

Each storage pointer is valid only while body executes. In particular, callers must not retain a pointer or use it to materialize a value for a different existential or ABI representation. This is useful when one synchronous operation needs several dynamically typed source values to remain alive at once.

Parameters

  • instances: Erased Swift values to project.
  • body: Receives each value's dynamic type and initialized storage in the same order as instances.

Returns

The result of body.

Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally