ReleaseTrigger
public class ReleaseTrigger<ReferenceType>
A class which holds a reference and calls a closure when the classes’ instance gets released.
Important
This type is not sendable, useSendableReleaseTrigger instead for a sendable version.
-
Initializes an object.
Declaration
Swift
public init( reference: ReferenceType, onDeinit: @escaping (_ reference: ReferenceType) -> Void )Parameters
referenceThe object or value to keep a reference on during lifetime of this object.
onDeinitThe closure to call when this object gets released. As a parameter the
referencewill be passed.
View on GitHub