AttachToCompose
Binds this subscribable to the current Compose host's lifecycle. Each platform actual dispatches based on the concrete subtype:
Android — if the receiver is
ActivityLifecycleSubscribable, drivessubscribe(manager)/unsubscribe()fromLocalLifecycleOwner+LocalContextvia aDisposableEffect.iOS — if the receiver is
ViewControllerLifecycleSubscribable, drives subscribe with the controller fromandroidx.compose.ui.uikit.LocalUIViewController.macOS — if the receiver is
WindowLifecycleSubscribable, drives subscribe with the window from this module's LocalNSWindow composition local (installed at the host'sWindowScope { LocalNSWindow provides window }entry point).
Any other LifecycleSubscribable (or a subscribable whose subtype isn't recognised on the current platform) is a no-op — useful for service builders that are conceptually lifecycle- aware on Android but pure functions on iOS/macOS.
Drives every LifecycleSubscribable held by this view model from the current Compose host. Returns the receiver so call sites can chain: val vm = viewModel<X>().AttachToCompose().
Binds this subscribable to the current Compose host's lifecycle. Each platform actual dispatches based on the concrete subtype:
Android — if the receiver is
ActivityLifecycleSubscribable, drivessubscribe(manager)/unsubscribe()fromLocalLifecycleOwner+LocalContextvia aDisposableEffect.iOS — if the receiver is
ViewControllerLifecycleSubscribable, drives subscribe with the controller fromandroidx.compose.ui.uikit.LocalUIViewController.macOS — if the receiver is
WindowLifecycleSubscribable, drives subscribe with the window from this module's LocalNSWindow composition local (installed at the host'sWindowScope { LocalNSWindow provides window }entry point).
Any other LifecycleSubscribable (or a subscribable whose subtype isn't recognised on the current platform) is a no-op — useful for service builders that are conceptually lifecycle- aware on Android but pure functions on iOS/macOS.
Binds this subscribable to the current Compose host's lifecycle. Each platform actual dispatches based on the concrete subtype:
Android — if the receiver is
ActivityLifecycleSubscribable, drivessubscribe(manager)/unsubscribe()fromLocalLifecycleOwner+LocalContextvia aDisposableEffect.iOS — if the receiver is
ViewControllerLifecycleSubscribable, drives subscribe with the controller fromandroidx.compose.ui.uikit.LocalUIViewController.macOS — if the receiver is
WindowLifecycleSubscribable, drives subscribe with the window from this module's LocalNSWindow composition local (installed at the host'sWindowScope { LocalNSWindow provides window }entry point).
Any other LifecycleSubscribable (or a subscribable whose subtype isn't recognised on the current platform) is a no-op — useful for service builders that are conceptually lifecycle- aware on Android but pure functions on iOS/macOS.
Binds this subscribable to the current Compose host's lifecycle. Each platform actual dispatches based on the concrete subtype:
Android — if the receiver is
ActivityLifecycleSubscribable, drivessubscribe(manager)/unsubscribe()fromLocalLifecycleOwner+LocalContextvia aDisposableEffect.iOS — if the receiver is
ViewControllerLifecycleSubscribable, drives subscribe with the controller fromandroidx.compose.ui.uikit.LocalUIViewController.macOS — if the receiver is
WindowLifecycleSubscribable, drives subscribe with the window from this module's LocalNSWindow composition local (installed at the host'sWindowScope { LocalNSWindow provides window }entry point).
Any other LifecycleSubscribable (or a subscribable whose subtype isn't recognised on the current platform) is a no-op — useful for service builders that are conceptually lifecycle- aware on Android but pure functions on iOS/macOS.
The web has no platform lifecycle owner (Activity/UIViewController/NSWindow) to bind to, so any LifecycleSubscribable is a no-op here — matching the documented behaviour for unrecognised subtypes.