iOS Application Development Practices

Some of the key technology and practices that we follow for iOS development is given below

Xcode – Xcode is the IDE of choice for most iOS developers, and the only one officially supported by Apple. Xcode has inbuilt functional, user interface and performance testing modules and can easily create mock environments to create error free application.

CocoaPods – for external dependencies (e.g. third-party libraries) we use CocoaPods which offers easy and fast integration.

Project Setup – A common question when beginning an iOS project is whether to write all views in code or use Interface Builder with Storyboards or XIB files. Both are known to occasionally result in working software. Reflections use the choice of code and story boards in its appropriateness to build iOS applications.

Carthage – Carthage takes the “simple, not easy” approach by building your dependencies into binary frameworks, without magically integrating them with your project in any way. This also greatly reduces build times, because your dependencies have already been compiled by the time you start building.

Project Structure – To keep all those hundreds of source files from ending up in the same directory, it’s a good idea to set up some folder structure depending on your architecture. For instance, you can use the following:

  • Models
  • Views
  • Controllers (or ViewModels, if your architecture is MVVM)
  • Stores
  • Helpers

Localization – Keep all user strings in localization files right from the beginning. This is good not only for translations, but also for finding user-facing text quickly. You can add a launch argument to your build scheme to launch the app in a certain language, e.g. -AppleLanguages (Finnish)

AFNetworking – A perceived 99.95 percent of iOS developers use this network library. While NSURLSession is surprisingly powerful by itself.

Architecture (Model-View-ViewModel (MVVM)) – Motivated by “massive view controllers”: MVVM considers UIViewController subclasses part of the View and keeps them slim by maintaining all state in the ViewModel.

Data Storage – If your app needs to store sensitive data, such as a username and password, an authentication token or some personal user details, you need to keep these in a location where they cannot be accessed from outside the app. Reflections never use NSUserDefaults, other plist files on disk or Core Data for this, as they are not encrypted! In most such cases, the iOS Keychain is what is used.

Networking – Keep any HTTP traffic to remote servers encrypted with TLS at all times. To avoid man-in-the-middle attacks that intercept your encrypted traffic, you can set up certificate pinning. Popular networking libraries such as AFNetworking and Alamofire support this out of the box.

Logging – Take extra care to set up proper log levels before releasing your app. Production builds should never log passwords, API tokens and the like, as this can easily cause them to leak to the public. On the other hand, logging the basic control flow can help you pinpoint issues that your users are experiencing.

User Interface – When using UITextFields for password entry, remember to set their secureTextEntry property – true -to avoid showing the password in cleartext. We always disable auto-correction for the password field, and clear the field whenever appropriate, such as when your app enters the background.