Introduction
SimpleNFL is a Kotlin app utilizing the ESPN API to provide league news, scores, and rosters.
This app is built with an MVVM strucuture utilizing a SharedViewModel class with coroutines. Because it is single activity with fragments, a SharedViewModel allowed for ease of data sharing between fragments. I use Retrofit paired with Moshi to handle the Json response.
Research
The research took about a week.
I was inspired by the Rick and Morty MVVM tutorial I found on the YouTube channel: The Android Factory . The channel is phenominal and provided me with the right tools to build this app. I learned a ton from the Rick and Morty tutorial. This tutorial not only touches on MVVM, Retrofit, Moshi, and handling safe API calls, it also teaches you how to build an app using Airbnb's Epoxy library. Step-by-step, the Andriod Factory host provides you with knowledge in great detail.
In order to truly learn everything from this tutorial and hammer this info into my brain, I decided to find an api similar to the api used in the tutorial: rickandmortyiapi.com.
Initially, I found some differences. However, not enough to deter me from making a simple NFL app built using ESPN's api. I'm a big sports guy and watch the NFL, so I felt this would be a great project.
Result:
Reflection
I understood how to use MVVM, Retrofit, and Moshi before building this app, but now I really understand it.
I built features in a repetitive manner in order to learn how to use MVVM correctly with coroutines. From a NFLService class, to an ApiClient class, building a SimpleResponse, launching the call in a Repository class and then using a viewModelScope() in a ViewModel class.. I finally get it. I understand the cycle.
I'll continue to utilize MVVM, Retrofit, and the Epoxy library.