Skip to content

Instantly share code, notes, and snippets.

@burnoo
Created September 21, 2021 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burnoo/57c49aeee74d5dace485781c4652c3f0 to your computer and use it in GitHub Desktop.
Save burnoo/57c49aeee74d5dace485781c4652c3f0 to your computer and use it in GitHub Desktop.
Medium Cokoin 3
@Composable
fun Hello() {
val hello = get<Hello>()
Text(hello.text)
}
val previewModule = module {
factory { Hello(text = "preview hello text") }
}
@Preview
@Composable
fun HelloPreview() {
Koin(appDeclaration = { modules(previewModule) }) {
Hello()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment