Contents

passUnretained(_:)

Creates an unmanaged reference without performing an unbalanced retain.

Declaration

static func passUnretained(_ value: Instance) -> Unmanaged<Instance>

Parameters

  • value:

    A class instance.

Return Value

An unmanaged reference to the object passed as value.

Discussion

This is useful when passing a reference to an API which Swift does not know the ownership rules for, but you know that the API expects you to pass the object at +0.

CFArraySetValueAtIndex(.passUnretained(array), i,
                       .passUnretained(object))