Skip to content

Instantly share code, notes, and snippets.

@rachitmishra
Last active November 7, 2017 19:17
Show Gist options
  • Save rachitmishra/8e3af3358a40c5e93962dfd2719e5b41 to your computer and use it in GitHub Desktop.
Save rachitmishra/8e3af3358a40c5e93962dfd2719e5b41 to your computer and use it in GitHub Desktop.
dagger-android-fragment
/**
* Fragment with dependency `ConnectionUtils`
*/
class HomeFragment: Fragment() {
@Inject
lateinit var connectionUtils: ConnectionUtils // Requesting our dependency
override fun onAttach(context: Context?) {
AndroidSupportInjection.inject(this) // Providing the dependency
super.onAttach(context)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment