Skip to content

Instantly share code, notes, and snippets.

@orcchg
Created June 26, 2021 08:37
Show Gist options
  • Save orcchg/71e6a736f3c9ee9410f81e9e5f24e114 to your computer and use it in GitHub Desktop.
Save orcchg/71e6a736f3c9ee9410f81e9e5f24e114 to your computer and use it in GitHub Desktop.
class App : Application(), ApiContainer {
@Inject
@FeatureApis
lateinit var featuresMap: Map<Class<*>, @JvmSuppressWildcards Api>
@Suppress("Unchecked_Cast")
override fun <T> getFeature(key: Class<T>): T =
featuresMap[key] as T
override fun onCreate() {
DaggerAppComponent.factory()
.create()
.inject(this)
super.onCreate()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment