Instance Method
activate(invoking:)
Activates the lifecycle.
func activate(invoking didBecomeActive: () async -> Void) async
Parameters
- didBecomeActive
A callback to run while the lifecycle observes isActive == true. Typically forwards to didBecomeActive(). Awaited outside the lock so the callback may freely call back into register(priority:_:), isActive, or other lifecycle members.
Discussion
Idempotent: if the lifecycle is already active, the closure is not invoked and no transition is broadcast. On the inactive→active edge, the active flag is flipped under the lock, every subscribed isActiveStream continuation is yielded true, the lock is released, and then didBecomeActive is awaited.
Important
The lock is non-recursive. Do not call back into activate(invoking:) or deactivate(invoking:) from inside didBecomeActive — schedule that work via register(priority:_:) instead.