# Match Compose injection scopes to real UI ownership

DevFeed: [Match Compose injection scopes to real UI ownership](<https://devfeed.tech/articles/match-compose-injection-scopes-to-real-ui-ownership-23958.md>)

Original publisher: [Read original article](<https://cloud-inject.io/notes/compose-scope-lifecycle/>)

Published: 2026-08-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Koin - Cloud-Inject.io -Kotzilla](<https://devfeed.tech/sources/koin-cloud-inject-io-kotzilla.md>)

Topics: [Compose](<https://devfeed.tech/topics/compose.md>), [ui](<https://devfeed.tech/topics/ui.md>), [navigation](<https://devfeed.tech/topics/navigation.md>), [Process](<https://devfeed.tech/topics/process.md>)

Tags: [compose](<https://devfeed.tech/tags/compose.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [screen](<https://devfeed.tech/tags/screen.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

This tutorial explains how to align Compose injection scopes with actual UI ownership and lifecycle events. It distinguishes object retrieval from creation, discusses process, navigation-destination, request, and feature-session lifetimes, and recommends testing both retention and exit behavior.

## Source excerpt

Compose makes it easy to request an object close to the UI that uses it. Proximity is useful, but it does not define ownership. Recomposition can call a function many times. Navigation can keep or discard a back-stack entry. The operating system can recreate the process. A sound scope names the event that owns the object. Separate retrieval from creation Ask two questions for each injected object: Where is the object retrieved? Which lifecycle creates and releases it? A repository retrieved by a composable can still be process-scoped. A screen model can be owned by a navigation destination. A transient formatter can be created for each request. Write the lifetime next to the definition and test that the object survives, or does not survive, the intended event.