Contents

storeWhileEntityActive(_:)

Retains the Cancellable as long as the entity is active (see Entity.isActive). If the entity is deactivated, the Cancellable is released.

Declaration

@MainActor @preconcurrency func storeWhileEntityActive(_ entity: Entity)

Discussion

This method does nothing if the entity is already inactive.

Internally, this method stores an AnyCancellable in a transient component of the entity. The component is removed when the deactivate event for this entity is received.