Wednesday, 27 September 2017

iOS Layered Architecture


Hello Everyone, Hope you are all doing Good. I was planning to post some helpful swift, playground tutorials from long time. Before going deep in swift and swift playground, lets quick overview how our code communicate to iOS and hardwares. Lets knew about iOS Layered Architecture and iOS App lifecycle(may be will cover be in Next Blog).

Understanding a little about the technologies and tools contained in the SDK can help you make better choices about how to design and implement your apps.

Architecture of iOS is little bit same as MAC layered architecture but in iOS Apple replaced by MAC COCOA By COCOA Touch (Figure-1). Each of these layers is made up of a variety of different frameworks that can be used and incorporated into your applications.





At the upper most level iOS work as an mediator between the underlying hardware and the apps we create. Out app do not communicate to the underlying hardware directly.

Apps talk with the hardware through a collection of well defined system interfaces. These interfaces make it simple to write apps that work constantly on devices having various hardware abilities.

Lower level  layers: They gives the basic services which all application relies on
Higher level  layer: They gives sophisticated graphics and interface related services.

Apple provides most of its system interfaces in special packages called frameworks.
So what is this framework actually contains? - Framework is a directory that holds a dynamic shared library that is .a files, related resources like as header files, images, and helper apps required to support that library.

Every layer have a set of Framework which the developer use to construct the applications. Every version of iOS contains a set of frameworks. We can create our framework also and use them across multiple applications. But lets knew only about iOS framework now, we will learn creating our framework later :)

Lets know a little bit about each layer and see what frameworks it contains.

Cocoa Touch Layer


The Cocoa Touch layer contains key frameworks for building iOS apps. These frameworks define the appearance of your app. They also provide the basic app infrastructure and support for key technologies such as multitasking, touch-based input, push notifications, and many high-level system services. When designing our apps, we should investigate the technologies in this layer first to see if they meet our needs.

Frameworks contains: 

  • EventKitUI.framework - provides view controllers for presenting the standard system interfaces for viewing and editing calendar-related events.
  • GameKit Framework – implements support for Game Center which allows users share their game related information online
  • iAd Framework – allows you deliver banner-based advertisements from your app.
  • MapKit Framework – gives a scrollable map that you can include into your user interface of app.
  • PushKit Framework – provides registration support for VoIP apps.
  • Tweeter Framework – supports a UI for generating tweets and support for access the Twitter Services.
  • UIKit Framework – gives vital infrastructure for applying graphical, event-driven apps in iOS. Some of the Important functions of UI Kit framework:
    • Basic app management and infrastructure.
    • Multitasking support.
    • User interface management
    • Support for using custom input views that behave like the system keyboard
    • Support for sharing content through email, Twitter, Facebook, and other services
    • Support for Touch and Motion event.
    • Cut, copy and paste support and many more.
  • Newly introduce Framework
    • Message UI Framework.
    • AddressBookUI framework
    • Notification Center Framework


Media Layer

It is the second layer from the top of the stack. It provides the iPhone OS with audio, video, animation and graphics capabilities. As with the other layers of the iPhone OS stack, the Media layer comprises a number of frameworks that can be utilised when developing iPhone apps.

Frameworks contains  We can divide it into three parts:

  1. Graphics Framework:
    • UIKit Graphics – It describes high level support for designing images and also used for animating the content of your views.
    • Core Graphics framework – It is the native drawing engine for iOS apps and gives support for custom 2D vector and image based rendering.
    • Core Animation – It is an initial technology that optimises the animation experience of your apps.
    • Core Images – gives advanced support for controlling video and motionless images in a nondestructive way
    • OpenGl ES and GLKit – manages advanced 2D and 3D rendering by hardware accelerated interfaces
    • Metal – It permits very high performance for your sophisticated graphics rendering and computation works. It offers very low overhead access to the A7 GPU.                                                                                                                                                                                                                           
  2. Audio Framework:  
    • Media Player Framework – It is a high level framework which gives simple use to a user’s iTunes library and support for playing playlists.
    • AV Foundation – It is an Objective C interface for handling the recording and playback of audio and video.
    • OpenAL – is an industry standard technology for providing audio.                                                                                                                                                                                          
  3. Video Framework

    • AV Kit – framework gives a collection of easy to use interfaces for presenting video.
    • AV Foundation – gives advanced video playback and recording capability.
    • Core Media – framework describes the low level interfaces and data types for operating media.



Core Services Layer


It is the third layer from the top of the stack. The iPhone Core Services layer provides much of the foundation on which the above layers are built. It provide Peer-to-Peer Services, iCloud Storage, Block Objects, Data Protection, File-Sharing Support, Grand Central Dispatch, In-App Purchase, SQLite, XML Support features.

Frameworks contains:


  • EventKit Framework - The EventKit framework (EventKit.framework) provides an interface for accessing calendar events on a user’s device.
  • Accounts Framework - The Accounts framework (Accounts.framework) provides a single sign-on model for certain user accounts.
  • Address book framework – Gives programmatic access to a contacts database of user.
  • Cloud Kit framework – Gives a medium for moving data between your app and iCloud.
  • Core data Framework – Technology for managing the data model of a Model View Controller app.
  • Core Foundation framework – Interfaces that gives fundamental data management and service features for iOS apps.
  • Core Location framework – Gives location and heading information to apps.
  • Core Motion Framework – Access all motion based data available on a device. Using this core motion framework Accelerometer based information can be accessed.
  • Foundation Framework – Objective C covering too many of the features found in the Core Foundation framework
  • HealthKit framework – New framework for handling health-related information of user
  • HomeKit framework – New framework for talking with and controlling connected devices in a user’s home.
  • Social framework – Simple interface for accessing the user’s social media accounts.
  • StoreKit framework – Gives support for the buying of content and services from inside your iOS apps, a feature known asIn-App Purchase.
  • CFNetwork
  • System Configuration Framework


Core OS Layer:


This is the bottom layer of the hierarchy and is responsible for the foundation of the operating system which the other layers sit on top of. This important layer responsible to managing memory—allocating and releasing memory once the application has finished with it, taking care of file system tasks, handling networking, and other operating system tasks. It also interacts directly with the hardware.

Frameworks contains:


  • Core Bluetooth Framework - The Core Bluetooth framework (CoreBluetooth.framework) allows developers to interact specifically with Bluetooth low energy (LE) accessories. 
  • Accelerate Framework - The Accelerate framework (Accelerate.framework) contains interfaces for performing digital signal processing (DSP), linear algebra, and image-processing calculations.
  • External Accessory Framework -The External Accessory framework (ExternalAccessory.framework) provides support for communicating with hardware accessories attached to an iOS-based device.
  • Security Services framework.
  • Local Authentication framework.
  • 64-Bit support from IOS7 supports the 64 bit app development and enables the application to run faster.

Below Core OS layer hardware layer exists. Hardware devices are managed by iPhone OS and provides the technologies needed for implementing native applications on the phone.

In next part we will cover App Life cycle using Process, Main,AppDelegate and Window interface.




2 comments:

  1. Thanks for sharing this important information which give some tips about on this topic.
    iPhone app development Perth

    ReplyDelete