Managing your UIView states with IGCStatefulView

Most, if not all, of the apps today, display some sort of data to its users, whether it be scoreboards for Sports apps, various news and articles for News apps, or Stock Market-related information from Finance apps. As much as these apps want to provide its users valuable information all the time, there will be circumstances that will hinder these apps to function as such, like network errors, or server errors.

Apps should then be able to display these errors to users in such a way that it would be clear to users as to what happened when they tried to view information within the app.

Stateful Table Views

For mobile app development, there is a special sub-category for table views that does this kind of data handling, stateful table views. These table views convey different states with regards to its corresponding data set. Most of the stateful table views revolve around these three states: loading, success, error.

Loading is when the app is still processing its data to be fed as a data source to its table view. Success is when the app has successfully processed the data, displaying it to the table view in the process. Error is when the app has encountered any error (examples mentioned above) that may prevent the app from fetching the necessary data.

Right now, you might be wondering as to how to handle such cases. Luckily for us iOS developers, Cocoapods hosts a bevy of libraries that does the job for us. With that in mind, let’s focus on a library that does more than displaying states for table view, but also for collection views, and views in general — IGCStatefulView.

More than a stateful table view

IGCStatefulView, as its name suggests, functions the same with any other stateful table view libraries out there, but one of its advantages is that it can also accommodate UICollectionView, and UIView in general, in addition to its support to UITableView instances.

The idea behind this is that displaying of data is not only limited to UITableView instances. It can also be done via UICollectionView since it functions similarly to a UITableView. Also, not all data is presented as a list. For example, a details page of let’s say, a news article. Although plausible, but most of the time, displaying relevant information is done via UIScrollView or UIView.

Hope that you’ll find this library useful for your projects. If you want to know more about IGCStatefulView, how to integrate it to you own project, use it, or contribute to it, please do check its GitHub repository. Cheers!

Primary Photo by Gilles Lambert on Unsplash

Blog Posts by Jason Jon Carreos


Related Entries