As of October 22, 2013, the App Store reached the 1 million apps milestone, which is quite an impressive achievement. Most of these apps have been developed with the help of the iOS SDK, the software development kit developed by Apple Inc., which provides the necessary tools and frameworks for developers. More precisely:
The iOS SDK was launched in March 6, 2008 (known as iPhone SDK), and contains the tools and resources for developing native iOS apps, by using the Objective-C programming language. Actually, the iOS architecture can be regarded as a set of layers (don’t think of cake layers 🙂 ): the top layers have a high level of abstraction, while the lower ones are closer to the hardware. So let’s have a taste:
In this first part I’ll try to highlight the high-abstraction layers from the iOS SDK, which contain the frameworks that are most used by iOS developers and with the most notable impact upon users.
Cocoa Touch Layer
Cocoa Touch contains key features for developing iOS apps and it has a Model-View-Controller (MVC) software architecture. The frameworks found in Cocoa Touch define the appearance of the apps and provide support for technologies, such as: touch-based input, multitasking, Apple push notification service, gesture recognizers and so on.
The most important part of Cocoa Touch is the UIKit framework, which the iOS developer uses for creating and managing the iOS apps user interface. This layer contains classes like: UIAttachmentBehavior, UICollisionBehavior, UIPushBehavior.
Another important part of the chocolate Cocoa Touch Layer is Multitasking – which manages the states of the apps. Because the applications are designated for a mobile device, they must be built respecting the battery life and performance balance. So Multitasking allows apps to continue running in the background, while others are started, and in the same time preserving the battery life.
Below are the possible transitions for an app:
– App starts and enters Not running state -> didFinishLaunchingWithOptions is called
– App enters Active state -> applicationDidBecomeActive is called
– App becomes inactive and enters Inactive state -> applicationDidEnterBackground is called
– App is set to be closed after 5 seconds of inactivity and it enters Suspended state -> endBackgroundTask is called
Other features from this layer are: accelerometer support, view hierarchy, localization and camera support.
Rich graphics, audio and video are handled using the technologies from the Media layer.
This layer contains frameworks for graphics, audio and video – ome of the most important frameworks are:
– Core Graphics Framework: The iOS Core Graphics Framework (also known as the Quartz 2D API) provides a lightweight rendering engine
– Quartz Core Framework: The Quartz Core framework provides the animation and visual effects capabilities which are used by the UIKit framework
– Core Animation: It enhances the animation experience of the apps
There are other frameworks, such as: Core Image Framework, Core Audio Framework and Core Text Framework etc., which can be used to enrich the overall experience of the apps. Apple is recommending developers to use higher level frameworks because of their level of abstraction, however lower levels can come in handy if a greater control of the mobile device is needed.
The Core Services and Core OS layers are more fundamental and closer to the hardware than the previous 2 layers, discussed above. Although not all the developers are going to use the frameworks from these layers, they are very important because the higher level frameworks interact with the hardware of the device through the low level frameworks found in Core Services and Core OS.
Core Services Layer
The fundamental system services are managed by this layer. The Cocoa Touch is dependent for some of its functionalities on Core Services (for example the Core Motion Framework). Although it’s a core layer, it contains some High-Level features like:
• Peer-to-Peer Services: peer-to-peer connectivity over Bluetooth
• iCloud: used to store data that can be accessed from any device
• SQLite: enables you to embed a SQLite database into the apps and local database files can be created from the app, providing fast access to the database records.
The Low-Level features contain frameworks such as:
• Core Foundation Framework: contains a set of C-based interfaces and provides support for collection data types, string management, threads and run loops
• Core Motion Framework: used to access all motion-based data from the device
• Core Location Framework: provides to the apps information about location and heading by using the onboard GPS, cell or Wi-Fi radios
Core OS Layer
This layer is the lowest one (it sits on top of the device hardware) and most of the other technologies are built upon the Low-Level features that are found in this layer. Nonetheless, this layer provides some frameworks that can be used directly by the app, like the Accelerate framework (Accelerate.framework) and the Security framework (Security.framework).
So you can have access to many Low-Level features of the operating system, by using the LibSystem library (which has a C based interface). Some of these features involve BSD sockets, DNS services, Memory allocation, File-system access.
However, this is not all, because the iOS SDK contains some useful developers tools too, the most important one being Xcode. For an in-depth review of Xcode, see Xcode 5 Essentials.
Xcode has reached the 5th version and it is the best IDE (Integrated Development Environment) for the Apple operating systems, providing all the tools necessary for developing and testing applications for Mac, iPhone, iPad and iPod Touch.
The instruments from Xcode can be used to examine the behavior of processes, records sequences of user actions that can be replayed, monitor and gather data about memory usage, disk and network activity. Also, it provides help in testing the applications. The new compiler technology (Apple LLVM Compiler) found in Xcode 5 is constantly evaluating your code as you type it, identifies the coding mistakes and it shows the developer ways to fix it.
The iOS Simulator reproduces almost perfectly an iOS device, it’s easy to launch and debug, it can simulate touch gestures by using the mouse and it contains specific developer tools.
The iOS SDK contains many more frameworks and tools, for a complete description of it you can access the iOS Developer Library. While this SDK can be used, in most cases, by an un-experienced developer, still it contains certain low-level features that require more advanced development skills.