Created
May 6, 2020 19:11
-
-
Save Rasalexman/b1bfa184564c98f17448cc3e53603b6a to your computer and use it in GitHub Desktop.
Dependency injection example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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