This is example code to showcase a reactive aproach to load data into a View Model.
The full article can be found on Medium
If you run the project, you will see a screen that can:
- Load data from memory directly if it is there
- Load data from another source if data is not available in memory
- Offer retry mechanism if data fails to load
- After data successfully is loaded, updates to the data will populate the screen
- You can refresh data by pushing a button
- If refreshing data fails, you are informed.
In the example project loading of data is randomized, giving you a 50/50 chance of successfully loading data. In the following GIF's you will see the behavior described above: