Skip to content

swift_dynamicCast(__________)

0x41c edited this page Feb 28, 2022 · 1 revision

swift_dynamicCast(_:_:_:_:_:)

Tries to preform a cast on one value type to another with the possibility of failing.

@_silgen_name("swift_dynamicCast")
public func swift_dynamicCast(
    _ destinationLocation: UnsafeRawPointer,
    _ sourceValue: UnsafeRawPointer,
    _ sourceType: Any.Type,
    _ destType: Any.Type,
    _ flags: Int
) -> Bool

Parameters

  • destinationLocation: A buffer to write the cast value into. When the cast fails, this is left uninitialized.
  • sourceValue: A pointer to the source buffer to cast into the destination. This may be left uninitialized after the operation, depending on the flags.
  • sourceType: The type associated with the source buffer.
  • destinationType: The type associated with the destination buffer.
  • flags: Flags controlling how the operation is carried out.

Returns

True if the cast succeeded. Depending on the flags, swift_dynamicCast may fail rather then return false.

Types
Protocols
Global Typealiases
Global Functions
Clone this wiki locally