Android Components
Koject provides multiple components for Android, including @ActivityComponent and @ViewModelComponent.
Here's a summary of all available components.
LINK
Refer to the Component documentation for a basic understanding of Components.
Available Components
| Component name | Injectable types | Inject function | Docs |
|---|---|---|---|
| Root (not set) | ApplicationContext | inject()lazyInject() | Link |
@ViewModelComponent | SavedStateHandleCoroutineScope(@ViewModelCoroutineScope) | ComponentActivity.lazyViewModels()Fragment.lazyViewModels()injectViewModel()(Composable) | Link |
@ActivityComponent | ComponentActivityActivityContext(@ActivityContext)CoroutineScope(@ActivityCoroutineScope) | ComponentActivity.inject()ComponentActivity.lazyInject() | Link |
@FragmentComponent | FragmentFragmentActivityComponentActivityActivityContext(@ActivityContext)CoroutineScope(@FragmentCoroutineScope)CoroutineScope(@FragmentViewCoroutineScope) | Fragment.inject()Fragment.lazyInject() | Link |
@ComposeComponent | Context(@ComposeContext)CoroutineScope(@ComposeCoroutineScope) | rememberInject() | Link |