MVC; the age old architectural pattern; has been trusted by developers around the world to separate responsibilities of a software program regardless of language and platform. Anyone working in iOS applications starts with this pattern and gets comfortable with it in a really short amount of time. But an iOS developer who has been in the industry for a while would be at least getting started to familiarize with the notorious Massive View Controller paradigm by now. This problem has been here like always, and there are a lot of great articles to understand the problem and how to reduce them. I’ll list some of them which I found really helpful at the end of this blog post.
It has been almost or, more than 2 years I had created this controller called SHViewPager. And to my utmost surprise a lot of people actually got benefited from it. Some of them requested for the support for screen orientation and iPad. I was a bit busy (actually lazy! sorry guys, truly!) to keep the request. Finally after a long wait, I was thinking, why am I not doing it?
We all know the three basic principles of OOP: Encapsulation, Inheritance and Polymorphism. And there is also this fourth principle: Data Abstraction; though it’s not always mentioned as a standalone principle, as it is closely tied with encapsulation. Today I am going to discuss a simple case to display the power and necessity of Inheritance.
Let’s assume a scenario: you are working on an application, which has to perform a server call asynchronously and has no direct impact on the UI. But when the server returns a response, you have to make some modification to your application regardless of the present UI.
For a recent project of mine, I had created this custom controller. This is quite similar to the ViewPager control used in Android. I’ve named this controller SHViewPager, here is the gitHub link. Continue reading