Skip to content

Instantly share code, notes, and snippets.

@RuiAAPeres
Created January 8, 2016 10:54
Show Gist options
  • Select an option

  • Save RuiAAPeres/165ddbb03b5bc56d2459 to your computer and use it in GitHub Desktop.

Select an option

Save RuiAAPeres/165ddbb03b5bc56d2459 to your computer and use it in GitHub Desktop.
Requirements
1. The work should only be started when we spend more than 0.5s in the ViewController
2. Check if there is data in the cache
2.1 Success: Show it and start an internet request if the cache is outdated
2.1.1 Success: Show the data
2.1.2 Failed: Silently fail
2.2 Fail: Try to get data from the internet
2.2.1 Success: Show it
2.2.2 Fail: Show the error
3. Every 5 minutes start internet request check, if cache is outdated && ViewController is visible
3.1 Success: Show the data
3.2 Failed: Silently fail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment