-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mvvm implementation with coroutines #2521
Comments
Hi! You can take a look at this repo for an exemple of using Apollo Android with ViewModels: https://github.com/BoD/apollo-graphql-android-sample |
I don't think that's what I am looking for. |
I'm not aware of anything like this unfortunately. Apollo is a way access your API like Retrofit so swapping out the retrofit Service with an ApolloClient should be close enough to the end result. |
Hi, here is a very good and perfect implementation of everything i talked about |
Any update on this? |
Apollo provides implementation for the networking layer for GraphQL API the same way as Retrofit provides implementation for networking layer for REST API. So technically if you replace anything related to the Retrofit with Apollo in the article you provided as a sample, you will get what you are looking for. |
The implementation for retrofit and apollo is really different and I don't think you can just replace Retrofit stuff with Apollo with exact same structure |
Any help? |
Note: I'm new to android development. I made a data access layer for apollo in an android app based on work done by my colleague with setting up a Room database (we're replacing the room implementation with apollo), as well as the code samples hosted here: https://github.com/apollographql/apollo-android/tree/master/samples/kotlin-sample the repository I linked has been a great resource, and they do have code examples for coroutines as well (I went with rxJava). As for your specific question about interfaces, I'm guessing they are similar to android's Room db interfaces -- I replaced those with abstract classes for every model we're tracking. I needed to use abstract classes because I "plug in" the correct datasource in the viewModel on runtime, extending them from a base abstract class. I hope that these are enough pointers to get you started. |
Hi, I also would love the official apollo android guide to follow googles recommended design patterns. Is there any reason as to why the apollo guide is not using LiveData? |
Hi @jorgenfaunaapp sorry for the hugeee delay! There's no specific reason not to include more documentation and guides. The main one is that all this takes a lot of time and it's a tradeoff between writing new features, maintaining the library vs writing documentation. There are a few different architectures out there and every team has its preferences. If you add other dimensions into the mix like compose vs views, RxJava vs Coroutines, etc... covering everything and keeping everything up to date is a huge task. That being said, documentation is hugely important and we'll make a pass at the tutorial and samples for the upcoming 3.0 release. Certainly updating to new architectural patterns and jetpack compose along the way We're also happy to link any community samples. If you have a repo with your preferred architecture or a blog post that helped you, feel free to send it so we can review it and include it in the docs. |
Hi, Any update on the docs? @martinbonnin |
Hi, is there any guide on how to implement apollo with mvvm architecture using coroutines?
The text was updated successfully, but these errors were encountered: