https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
c

Christopher Elías

10/02/2020, 1:42 PM
Hello you all 🙋‍♂️, What do you think about this approach? On an Android project with a modularization per feature architecture, would you create a retrofit instance per each feature? Isn't this very costly? My friends and I are currently working on this kind of architecture, and we are in the stage of integrate the REST API. We are trying to isolate as much as we can every feature. But should we create a retrofit instance on each feature module that needs to call a service or should we have another module let's say "data" and handle all the retrofit thing there? What would you do?
2️⃣ 1
f

faogustavo

10/02/2020, 3:32 PM
Why don’t you change a little bit? Having a single instance of retrofit and each module receives the instance and generate the objects for the interfaces?
3
This way, each module still know only about its data/requests and you dont need to create too many instances from the retrofit object
3 Views