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) | Application Context | inject() lazyInject() | Link |
@ViewModelComponent | SavedStateHandle CoroutineScope (@ViewModelCoroutineScope ) | ComponentActivity.lazyViewModels() Fragment.lazyViewModels() injectViewModel() (Composable) | Link |
@ActivityComponent | ComponentActivity Activity Context (@ActivityContext )CoroutineScope (@ActivityCoroutineScope ) | ComponentActivity.inject() ComponentActivity.lazyInject() | Link |
@FragmentComponent | Fragment FragmentActivity ComponentActivity Activity Context (@ActivityContext )CoroutineScope (@FragmentCoroutineScope )CoroutineScope (@FragmentViewCoroutineScope ) | Fragment.inject() Fragment.lazyInject() | Link |
@ComposeComponent | Context (@ComposeContext )CoroutineScope (@ComposeCoroutineScope ) | rememberInject() | Link |