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
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