Last active
September 13, 2019 18:54
-
-
Save alejandro-rios/ecb7dbe75863b4faa7049a9bc11f85a9 to your computer and use it in GitHub Desktop.
Basic Hello World with Katana
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 Info(val text: String) | |
// Module | |
val bag = Module { | |
singleton { Info("Hello Katana") } | |
} | |
// MainActivity | |
class MainActivity : AppCompatActivity() { | |
// Component | |
private val component = Component(modules = listOf(bag)) | |
// Retrieve Dependencies | |
private val magicBox: Info by component.inject() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
text_view.text = magicBox.text | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment