Skip to content

Instantly share code, notes, and snippets.

@CostaFot
Last active May 13, 2024 23:01
Show Gist options
  • Save CostaFot/24415c442f28a6b0f1d3432aed1f863d to your computer and use it in GitHub Desktop.
Save CostaFot/24415c442f28a6b0f1d3432aed1f863d to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
@Inject lateinit var firstScreenTracker: FirstScreenTracker
@Inject lateinit var viewModelFactory: ViewModelFactory
override fun onCreate(savedInstanceState: Bundle?) {
DaggerFirstComponent.builder().build().inject(this) // build dagger component and inject
super.onCreate(savedInstanceState)
setContent {
AppTheme {
Surface {
FirstScreen(
navigate = { TODO() },
firstScreenTracker = firstScreenTracker, // pass injected parameters downstream to composable
viewModelFactory = viewModelFactory
)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment