Created
May 6, 2019 23:46
-
-
Save seyedjafariy/5404eefa9a5cc10312e0740dd4a2b1e7 to your computer and use it in GitHub Desktop.
extensions file to ease the usages of Dagger dependencies
This file contains hidden or 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
fun Context.coreComponent(): CoreComponent = | |
if (applicationContext is CoreComponentProvider) { | |
(applicationContext as CoreComponentProvider).core() | |
} else { | |
throw IllegalArgumentException("app class must implement CoreComponentProvider") | |
} | |
fun View.coreComponent(): CoreComponent = | |
context.coreComponent() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment