anvil
Pokedex
anvil | Pokedex | |
---|---|---|
8 | 7 | |
1,266 | 7,626 | |
0.8% | - | |
9.5 | 9.0 | |
7 days ago | 3 days ago | |
Kotlin | Kotlin | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
anvil
-
Refactoring our Dependency Injection using Anvil
Handling DI at scale can be a challenging task in avoiding circular dependencies, build bottlenecks, and poor developer experience. To solve these challenges and make it easier for our developers, we adopted Anvil, a compiler plugin that allows us to invert how developers wire, hook up dependencies and keep our implementations loosely coupled. However, before we get into the juicy details of using this new compiler plugin, let's talk about our current implementation and its problems that we are trying to solve.
-
Having both Dagger and Hilt at the same time? 🤔
I would recommend checking out Anvil for multi-module setup as it can provide an easier migration path than Hilt while also providing similar features.
-
Whetstone: A DI framework for Android that simplifies working with Dagger 2 using Anvil
In terms of of what Anvil is I'd really recommend reading the README It's a lot more flexible than Hilt and provides a code generation hook so if you have a codebase specific DI pattern you can also set that up to be auto-generated with a custom annotation if you desire.
-
Anvil, generating factories without kapt, and module structure.
Recently I've been looking into Anvil as an alternative to Dagger and realised that it can handily generate factories for you without kapt. That brings some exciting potential for build time improvement so I was eager to try it out. However very quickly I got stuck.
-
Multiplatform dependency injection libraries equivalent to Dagger/Anvil
I'm currently using Dagger and Anvil for my DI needs. It's been working really well, especially around what Anvil permits in terms of multibindings defined on the type declaration rather than in a module. For example:
-
Toying with Kotlin's Context Receivers
Have you considered something like Dagger + Anvil (https://github.com/square/anvil) ? It works well enough that it gets out of your way. Is it doing insane things in the background at compilation time ? Absolutely. But it's worth it. And to save time in debug, you can shim in dagger-reflect to avoid the cost of having to run annotation processors.
-
N26 Path To Anvil
For more details, check the official documentation: Anvil Dagger Factory Generation.
-
N26 Path to Anvil
And finally, testing: Anvil offers a replace module feature that is handful to provide new dependencies during tests. For that, we create helper modules called testing and we provide fake dependencies of those replacing the production modules. Developers that include the testing in their test classpath can automatically interact with our testing utilities (or create their own, if required). To be completely honest here, it is more of an ongoing process.
Pokedex
-
Old android dev looking to refurbish knowledge
And this is a decent github repo to check out to get an idea of a modern architecture/state of app dev: https://github.com/skydoves/Pokedex
-
How to become a better Android developer?
For example this one is decent https://github.com/skydoves/Pokedex
-
Nifty, well made, small apps you've run into?
The Pokedex app has almost everything you could want. Hilt, Retrofit Coroutines, MVVM(I prefer MVI), etc
- Open source apps that use Android architecture components?
- Source code
-
Advice needed regarding MVVM Pattern
I would recommend reading the code of the following project. It uses all the modern practices including live data, hilt, paging 3 with mvvm. https://github.com/skydoves/Pokedex
-
Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.
Exactly! But we can implement it better without creating backing properties for preventing access from outsides using this. code diff
What are some alternatives?
kotlin-inject - Dependency injection lib for kotlin
Android-CleanArchitecture-Kotlin - This is a movies sample app in Kotlin, which is part of a serie of blog posts I have written about architecting android application using different approaches.
Dagger2 - A fast dependency injector for Android and Java.
Stars - An android application build with a clean architecture approach and Star wars API
dikt - Simple and powerful DI for kotlin multiplatform
CbKtx - A lightweight Kotlin friendly wrapper around Couchbase lite for Android.
koin - Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
DevUpdates - News app for developer updates.
Poko - A Kotlin compiler plugin that generates equals, hashCode, and toString for plain old Kotlin objects in public APIs.
Quizzer - Trivia Game (Quiz App)
AndroidArchitectureTemplate
MvvmBase