The MVC Architecture is generally used in developing iOS applications.
However the “ViewController” approach widely used is the most evil part that messes up Views and Controllers: Developer writes both view animation and business logic in the UIViewController, hence introducing a MEGA-ViewController.
In this passage, we will share our experience on how VIPER saves our lives from this monster in one of our projects.
VIPER is not a framework but an approach to iOS application architecture, which stands for:
View and Controller are wrapped in a single UIViewController class. The UIViewController class constraints the fundamental view management of the iOS app. As the name convention suggests, view controllers often handle both business logics and logics for responding to user interactions.
In one of the Android app projects at Oursky, we started using Realm for data caching. So users won’t have to look at blank pages when they log back to the app, waiting for remote API results.
We think it’s a minimalistic yet reliable solution, and is worth giving it a shot for your next app. Just beware of the differences between versions, follow the conventions, and pay extra attention when using with other libraries.
More is discussed below in details and with example snippets.
What is Realm?
Realmis the mobile database solution that proposed as a replacement for SQLite & Core Data.
It’s like using SQLite with an ORM (as those who used SQLAlchemy may have experience), with a lot of awesome and convenient methods for data transactions.
However, Realm is NOT built on top of SQLite. It persists on its own persistence engine.
Realm is also cross-platform that supports both iOS and Android, so developers who write Java, Swift, Objective-C can share the same Realm files painlessly.
Over the years, we’ve been building loads of nicely-crafted iOS applications for our clients.
To keep everyone work closely, we send daily builds to our QA Team, beta users, clients, other team members. However, building an iOS is still painful for Project Manager — It involves compiling, uploading the app to TestFlight or HockeyApp,
setting up Crittercism for collecting crash reports (Those who have experience, should know that you have to upload dSym files for symbolic debug messages), notify everyone on Slack, etc.
Much better if we can automate all these with each Pull Request.