Static Methodswift 6.0.1Swift
passUnretained(_:)
Creates an unmanaged reference without performing an unbalanced retain.
static func passUnretained(_ value: Instance) -> Unmanaged<Instance>
Parameters
- value
A class instance.
Returns
An unmanaged reference to the object passed as value
.
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))
Other members in extension
Type members
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.
Instance members
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.