I love helping people understand the “why” and the “how” of building offline-first apps. An offline-first app is an app that works, without error, when it has no network connection. An offline-first app then applies progressive enhancement to enable additional features and functionality, such as syncing with a cloud database, when and if it has a reliable network connection. I’m happy to introduce to you a new sample app called Cloudant FoodTracker which demonstrates building an offline-first app using Cloudant Sync for iOS (we just released Cloudant Sync for iOS v1.0).
Apple provides a great tutorial on starting to develop iOS apps. The tutorial walks readers through creating a simple meal tracking app called FoodTracker. From the tutorial:
“This app shows a list of meals, including a meal name, rating, and photo. A user can add a new meal, and remove or edit an existing meal. To add a new meal or edit an existing one, users navigate to a different screen where they can specify a name, rating, and photo for a particular meal.”
In a strict sense of the term, Apple’s FoodTracker can be considered an offline-first app. As Apple’s FoodTracker has no network capabilities, it might be better to call it an offline-only app. All of your meal data is stored locally on the device–and it never leaves the device. Soon we will publish a tutorial that walks you through transforming Apple’s FoodTracker into a true offline-first app that stores its data locally using Cloudant Sync for iOS, and then synchronizes this data with IBM Cloudant. For those of you who want an early preview, we’ve published the Cloudant FoodTracker code on GitHub.