Wednesday, February 21, 2018

iOS Architecture - Fix Massive View Controller

To solve the Massive View Controller, we distribute the tasks to different classes:

1. Router
    The Router class will capable to handle all navigations such as segue or custom.
    Also capable to construct the view controller

2. SBControl
    This class will keep all storyboard controls, and its makeups such as setting font, colours and localised texts and animations etc..

3. Presenter  - implements UIEvents protocol
    Responsible to handle user actions from View Controller. This is just a dispatcher. Handle a little business logics. Presenter will ask to viewmodel to perform the data manipulations and will return the result to the view controller using the DisplayUI protocol which is implemented by View Controller.
    Presenter will give the navigation task to the router
    Presenter will give the display task to the view controller
    Presenter will give the network operations to the service class

4. Service - optional
     Responsible to all network operations. Presenter will hold a protocol reference which is implemented by Service class

5. ViewModel
     There will be separate view models for each view. It will be responsible to handle business logic as well as the presentation logic. Both will be grouped using protocols.

6. ViewController
    Responsible to the VC life cycle. Inform all UI actions to the Presenter. ViewController implements a DisplayUI protocol.

7. UIController (optional)
    Handle the tableview/collection/text view delegates here to reduce the code in View Controller and also to distribute the functionalities.


Tuesday, December 12, 2017

OpenOffice. - Freeze or Scroll Lock the first row or any row or column.

If you want to freeze first row, then select the second row and in menu. Window -> Freeze.

Convert Localizable.strings to a spread sheet or csv / xls file


1. Rename the Localizable.strings file to Localizable.csv and open it in OpenOffice.

2. Give the separator as “=“

Then we can save as it in our format such as .xls

Tuesday, July 11, 2017

Some iOS Interview Questions

1. What are the application states
2. UIViewController Life Cycle in the order. 
3. Whats the minimum number of constraints we need for a UIView
4. Whats the minimum number of constraints we need for a UIButton/UILabel/UIImageView
5. Can we create an app without using a UIViewController

Monday, February 15, 2016

Error - You have selected the Production server, yet your Certificate does not appear to be the Production certificate! Please check to ensure you have the correct certificate!


This is the error got from our .NET team when trying to push messages to iOS device with AdHoc/AppStore profile.

The issue was with the certificate file (.p12). 

When we create certificate (.p12) , Always export like selecting the certificate only. see the attached image


Wednesday, December 16, 2015

Swift - Crash 'Bad Access' with Release mode Xcode 7.1.1

sortInPlace function of array is crashing when running on iOS8 6+ device. 

Its fixed with Xcode 7.2 version