The Apple Corporation uses Cocoa as its premier object-oriented programming language for iOS. The Cocoa Touch Application Programming Interface includes the following features:
- Gesture detection
- Graphical control elements
It is based for iOS operating system for Apple’s products such as:
- iPod Touch
- Apple TV
Internally, Cocoa encompasses Core Data frameworks, Application Kit and Foundation Kit, included in its Cocoa.h header file. Moreover, other frameworks and libraries are also incorporated, such as Objective-C runtime and C standard library.
Cocoa apps are developed with the help of Apple’s development tools, specifically Xcode and Interface Builder. The language used is either Swift language or Objective-C.
Cocoa apps are written in its programming environment for end users. These apps have a distinct touch to them as Cocoa programming environment has the ability to automate multiple elements of an app for complying with Apple’s guideline for human interface.
In this article, we provide a brief overview of Cocoa Touch and answer the all important question-‘What’s new in Cocoa Touch’ for both users and developers.
Foraying into Cocoa Touch
The basic development process is all-too-familiar to Mac app developers. If you have already used the Mac OS X, you will find this mobile OS sharing various similarities. The ultimate difference is that of upgraded Cocoa version from Apple, known as Cocoa Touch.
Cocoa Touch has been the foundation of iPhone applications, enabling it allow developers to leverage the touchscreen interface, and interface that has been instrumental in forming the initial popularity of the iPhone . EA’s Spore and Apple’s Touch Fighter games are the tip of the iceberg when we talk about the potential of this technology in the hands of creative developers. Apart from game development, it has numerous possibilities, and its main frameworks are as follows:
- Core Audio
- Audio and video
- AV Foundation
- Media Library
Now, iOS 8 has updated the Cocoa Touch framework further for app production in the iOS ecosystem, with adaptivity being the focal point. This entails the following features:
Adaptivity as Design Philosophy
It’s a new methodology of design which will remain a mainstay of app development on Apple from this point forward. It also incorporates using generic code, reusing program changing from one context to another. It also comes with the ability to import within different Apple devices seamlessly.
Adaptive Code for Multiple Apple Devices
This is an inherent feature of adaptivity. A simple example is as follow:
- You take a simple primary and secondary view controller pattern for iPhone
- Then you use that same code that puts the phone on the interface that one expects on a tablet (that too without any verification process)
- While all this time, one single code is running on the iPhone and iPad
Adaptive view controllers, as the name suggests, allow you to write code that becomes adaptable so that you can use it for multiple devices, rather than writing unique code for each.
The 3rd bullet point (code that is adaptive and can be used on multiple devices) serves as the focal point. By extension, another new interface is to be introduced for adoption in apps, namely the dynamic text. The feature was actually supposed to be installed in the previous iOS for changing the text size as per preference. For iOS 8, the idea has been extended so that now the operating system becomes responsive to dynamic text. Thence, by choice of user’s dynamic text, the rows expand as does the text. Moreover, adaptivity also provides an opportunity to adjust the system as per user’s requirements by incorporating functionality in in-built apps and 3rd party apps.
The primary focus in adaptive layout is on interface orientation. It’s a standard fixture in API since SDK was initiated. The core idea was about the compatibility of the layout code regardless of the interface orientation.
Basically, size class is a simple enumeration which is related to canvas size while working on layouts instead of interface orientation. There are vertical and horizontal sized classes (they can be regular/ compact). This is the key distinction between iPhone and iPad styled interface.
UI Trait Collection
The concept of size class has been wrapped up with induction of UI Kit also known as UI Trait Collection. UI Trait Collection is a unique amalgamation of vertical size class, horizontal size class, user interface Idiom and display scale. They are more convenient since they exist separately on the UI View Controller.
iOS 8 now has an option for users to select specific areas with an app extension to customize a particular function.
For instance, an app extension is furnished for users to post their favorite content on social media websites. The users can use this app extension after downloading it, just by tapping the share button. The extension is a code which accepts, confirms, and posts on the user’s behalf.
Moreover, iOS supports the following app extensions, also termed as extension points:
- Action: Executing a routine task with present content
- Widget: Enable/ provide a brief to-do in Notification Center
- Share: Uploading content on social media websites
- Editing photos: Editing videos/ photos while remaining in photo app
- Document provider: A stand-alone location for storing documents for easy access
- Custom keyboard: The user can use this custom keyboard instead of system keyboard for usage
Every extension gives different API for its usage
Finally we have the document picker. What this does is give you access to capabilities that are beyond the app’s sandbox. Not only does it help you share documents between apps (which is its main function), but also allows you to manage intricate workflows. Just an example, you can use the document picker to edit a single document with more than one app.
But that’s not all. You can also access files from various document providers, while 3rd party developers can provide additional document providers using the Storage Provider extension. The document picker programming guide can be downloaded at the Apple Dev center.