Skip to content

Instantly share code, notes, and snippets.

@Rasalexman
Created May 6, 2020 19:11
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 Rasalexman/b1bfa184564c98f17448cc3e53603b6a to your computer and use it in GitHub Desktop.
Save Rasalexman/b1bfa184564c98f17448cc3e53603b6a to your computer and use it in GitHub Desktop.
Dependency injection example
class MainActivity : AppCompatActivity(), IKodi {
private val myClass: MyClass by immutableInstance() // 1.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val myClassInstance = instance<MyClass>() // 2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment