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, use SendableReleaseTrigger instead for a sendable version.
  • Initializes an object.

    Declaration

    Swift

    public init(
    	reference: ReferenceType,
    	onDeinit: @escaping (_ 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.