The new Apple iOS 8 platform has opened up a host of new opportunities for developers to make their mobile applications more customized and efficient. Let us here check out some interesting features of iOS 8, that app developers can make use of.
According to an Apple App Store Report (released mid-April), nearly 8 out of every 10 devices are currently working on the iOS 8 platform. This stat has a simple enough meaning for mobile app companies: unless their applications are not customized and completely compatible with the latest Apple mobile platform, their clientele will dwindle (with the imminent arrival of Apple Watch, this is even more so the case). We will here shed light on some important factors related to iOS 8 app development:
- Availability of Split View Controller on iPhone – Till the previous iteration of the iOS platform, UISplitViewController was present only on the iPad. Things have changed with iOS 8, with Split View Controller now available for new and upgraded iPhones. Keeping in view the larger screen sizes of iPhone 6 and iPhone 6 Plus, the vertical dimension (in landscape) has been renamed as ‘Regular’. Four different size classes have also been introduced – Vertical Compact, Horizontal Regular, Vertical Regular and Horizontal Compact. App developers can now use the UI of iPhone in portrait mode, and simulate the iPad UI in landscape.
- Understanding the software layers – For contemporary mobile app development experts, it is an absolute must to get a thorough idea of the underlying software programming network of iOS 8. The architecture hierarchy goes like: Cocoa Touch → Media → Core Services → Operating System, from where the code is directly deployed to the hardware of the device. The required codes for app presentation have been separated from that required for data handling, with the help of Model-View-Controller (MVC). In the OOP setup, the components of MVC (model, view and controller) are all treated as objects.
- Using extensions for debugging – Thanks to the app extensions in iOS 8, mobile app testing/debugging has also become easier. The host app to be used for debugging can be specified on Xcode (after the extension has been triggered). Including suitable breakpoints during this debugging process is extremely important though – barring which bugs can remain undetected. There is another bone of concern too – the latest versions of the iOS 8 extensions often fail to load properly.
- Adjusting the app display resolutions – Developers and UI/UX designers have to be more cautious while working on iOS 8 app projects. There are two additional pixel densities and screen resolutions to optimize their applications for. For iPhone 6, the required app resolution is 375×667, while that for iPhone 6 Plus is 414×736. The respective pixel densities for the two devices are 2x and 3x Retina display, respectively. The resolution of the iPad, of course, remains at 768×1024. Any new app has to be compatible with all of these resolutions (in addition to the resolutions of earlier-generation iPhones).
- Improved Auto Layout in iOS 8 – Initially introduced in iOS 6 as a replacement of the troublesome autosizing, Auto Layout has become all the more developer-friendly in iOS 8. Constraints on Auto Layout can be created by those making iPhone/iPad apps, through Visual Format Language, Interface Builder and API codes (involves manual coding). Remember that the constraints affect the alignment rect/content of the view, and not the frames. In explicit constraints, developers can now also specify the label width to increase upto a specified maximum point (in addition to the fixed specification option). Proper use of Auto Layout ensures that apps remain properly viewable and workable, whatever might be the resolutions/sizes of the devices they are installed on. In other words, Auto Layout helps iOS 8 applications become more dynamic.
- Requirement of HealthKit support – This is particularly important for iOS 8 developers who are planning to start out with WatchKit app development. The latest version of iOS has the HealthKit app, for accessing and storing the personal health/activity data of users. There are several new sensors in the new flagship iPhone, just like the ones that are present in Apple Watch (no surprises here, since Watch has to be paired with an iPhone). Three new query objects – HKObserverQuery, HKSampleQuery and HKAnchoredObjectQuery – have to be used by app development experts, to make sure that health data is being collected in apps correctly and on a real-time basis (a must-have feature in any health & fitness app).
- Using dlopen for extending support to iOS 7 – Most iOS app developers need to share their codes between the app and an extension. This is somewhat tricky in the iOS 8 environment – since simply using embedded frameworks is not of any use here. Instead, coders have to use ‘dlopen’ to write out the program and ensure dynamic, run-time loading of the framework. iOS 7 has to be included in the app target (otherwise, the shared code will work only on iOS 8), and developers also have to check if their codes are compatible with the earlier iOS version. In most cases, it is advisable to not enable modules in the build settings of Xcode. The results can be erratic.
- Views and Window objects in iOS 8 – For adding an engaging, interactive feel to the UI of an iOS 8 app, a proper understanding of Windows and Views is essential. Apple has provided app developers with several categories of views in the UIKit framework – Container Views, Alert Views, UIWindow, Navigation Views, Display Views and Controls. In the hierarchy, UIWindow is always at the top, followed by subviews (UIView) and UILabel and UIButton. To put it in another way, UIView has the UIWindow as the ‘Superview’ – while buttons, labels and texts are its ‘Subviews’.
- Table Views in the UIKit object – After the storyboard file has been created in Xcode, iPhone app developers have to implement the resources of UITableView class. Two different types of tables – dynamic and static – can be created, for presenting app data in a list format. The Table View, on the other hand can be either plain or grouped (with headers, footers, and different sections). There are four different cell styles to choose from as well – UITableViewCellStyleValue1, UITableViewCellStyleValue2, UITableViewCellStyleDefault and UITableViewCellStyleSubtitle. What’s more – on the iOS 8 platform, developers can also use ‘self-sizing’ tables.
- Managing animation coordinator for rotation – For updating the constants declared in the Auto Layout constraints and/or using frame-based layouts, the all-new rotation behavior in iOS 8 comes in very handy. On the View Controller, different rotation methods can be combined in a single method – viewWillTransitionToSize:withTransitionCoordinator. Whenever the view of an app is likely to change (e.g., due to rotation of the device by user, changes in the size of status bar), this method is called on to manage the rotation and arrange the animations.
- Split Views in iOS 8 – Another interesting addition to the iOS 8 app development framework is the Split View option (available in iPhone 6 Plus and iPad, in the landscape mode). Coders can use the UISplitViewController class to actually split the screen into: a) a Master Panel (on the left), and b) a Detail Panel (on the right). Note that, on iPhone 6, the Split View Controller can be used in the portrait mode. The items in the Master View have to be configured, along with the Detail View panel. Next up, the Master Selections have to be connected to the Detail View. Xcode automatically generates the master view controller as a subclass of UITableView. In the Main.Storyboard file, four items get created and stored – navigation controllers (2), the UISplitViewController, the MasterViewController and the DetailViewController.
- Understanding the difference between Share and Action extensions – A probable source of confusion for newbies in the domain of iOS app development – since the differences between Action and Share extensions in iOS 8 are subtle. The former calls upon SLComposeViewController in the Xcode template, while the latter can be inherited straight from UIViewController. Unlike Share extensions (required for creating the social integration tabs in apps), action extensions do not need any dedicated user-interface. Yet another difference between the two is that, while share extensions are viewable in the top row of the screen, action extensions remain in the bottom row.
- Swift files in iOS 8 – While most app developers have the option to code for apps in either Objective-C or Swift at present, the latter is likely to become the go-to language of iOS app makers soon. It is of essence that you know how to work with Swift files on the iOS 8 platform. First things first – an instance of NSFileManager has to be created (let filemgr = NSFileManager.defaultManager() takes care of that). Apart from copying, removing and comparing the contents of two or more Swift files (there are separate code snippets for each), app developers can also use the createSymbolicLinkAtPath method to generate symbolic links to any particular file. An NSError object can be included as an argument too.
- App testing on Xcode 6 – Device simulators are necessary, but far from sufficient, for thorough mobile app testing on iOS 8. On the latest Xcode 6 framework (Xcode 6.3 has been released), new apps can be tested on actual devices – thanks to the auto device registration option. After configuring Xcode with Apple ID and generating the required signing identities, developers can plug in device(s) to their Mac systems (after launching Xcode, of course). The attached devices will show up under ‘run destinations’. Manual registration of devices is possible too – but for that, you will have to provide the UDID of the same. Once the provisioning profile is ready, the app will be installed, launched and tested on the registered device(s).
The presence of well over 4000 new APIs in iOS 8 makes it imperative for developers to take some time out to learn how to make apps that would be properly customized on this platform. New coders have to, of course, register themselves as ‘Apple Developers’ first (doing so is free). Opting for a membership in the official iOS Developer Program is also a good idea. iOS 8 is, without a shadow of a doubt, extremely developer-friendly. All that you need to do is invest some time on getting a hang of its new tools and resources, and you will be able to start making apps on this platform.