Generic Structure

Unmanaged

A type for propagating an unmanaged object reference.

Overview

When you use this type, you become partially responsible for keeping the object alive.

Topics

Instance Methods

func autorelease() -> Unmanaged<Instance>

Performs an unbalanced autorelease of the object.

func release()

Performs an unbalanced release of the object.

func retain() -> Unmanaged<Instance>

Performs an unbalanced retain of the object.

func takeRetainedValue() -> Instance

Gets the value of this unmanaged reference as a managed reference and consumes an unbalanced retain of it.

func takeUnretainedValue() -> Instance

Gets the value of this unmanaged reference as a managed reference without consuming an unbalanced retain of it.

func toOpaque() -> UnsafeMutableRawPointer

Unsafely converts an unmanaged class reference to a pointer.

Type Methods

static func fromOpaque(UnsafeRawPointer) -> Unmanaged<Instance>

Unsafely turns an opaque C pointer into an unmanaged class reference.

static func passRetained(Instance) -> Unmanaged<Instance>

Creates an unmanaged reference with an unbalanced retain.

static func passUnretained(Instance) -> Unmanaged<Instance>

Creates an unmanaged reference without performing an unbalanced retain.

Relationships

Generic Constraints

  • Instance : AnyObject
    

See Also

Reference Counting

func withExtendedLifetime<T, Result>(T, (T) -> Result) -> Result

Evaluates a closure while ensuring that the given instance is not destroyed before the closure returns.

func withExtendedLifetime<T, Result>(T, () -> Result) -> Result

Evaluates a closure while ensuring that the given instance is not destroyed before the closure returns.