SendableReleaseTrigger
public final class SendableReleaseTrigger<ReferenceType> : Sendable where ReferenceType : Sendable
A class which holds a reference and calls a closure when the classes’ instance gets released.
Important
This type is sendable and thus its reference type has to be. Consider usingReleaseTrigger
if sendable is not needed.
-
Initializes an object.
Declaration
Swift
public init( reference: ReferenceType, onDeinit: @escaping @Sendable (_ reference: ReferenceType) -> Void )
Parameters
reference
The object or value to keep a reference on during lifetime of this object.
onDeinit
The closure to call when this object gets released. As a parameter the
reference
will be passed.