Google News
logo
IOS Interview Questions
iOS is the operating system for iPhone, iPad, and other Apple mobile devices. Based on Mac OS, the operating system which runs Apple’s line of Mac desktop and laptop computers, Apple iOS is designed for easy, seamless networking between a range of Apple products.
 
When the iPhone was introduced in 2007, its operating system was originally called "iPhone OS." Despite the name, the iPod Touch (which launched later in 2007) also ran iPhone OS.
 
iOS Initial release date : 29 June 2007
MVVM (Model View View-Model) is an iOS architectural design pattern in which we separate objects into three main components.
 
Model : It contains the application data. It is responsible for data parsing and data persistence.

View : It is responsible for displaying the model data on the screen, including the visual elements and controls. It is the subclass of UIView and highly reusable.

ViewModel : It contains the business logic that transforms the model data into the values and passes it to the view. In MVVM, all the business logic, including data manipulation, takes place at ViewModel.
* iOS supports SBJson framework.
* SBJson is a JSON parser and generator for Objective-C.
* It provides flexible APIs and additional control, making JSON handling easier.
MVC is the commonly used beginner-level software architecture design pattern made with the following objects.
 
The Model contains the things that are used to handle the data of the application. The models are used to parse the request and response with the server's API. Things like persistence, model objects, parsers, managers, and networking code reside here.

The View is treated as the face of the application. The object like UILabel and UITextField are the view objects that present the data on the screen. The view doesn't contain any domain-specific logic.

The controller is used as the mediator between the Model and the view via the delegation pattern. The controller doesn't need to know the concrete view it is working for. However, the controller contains the business logic to present the data that is parsed by the model and displayed by the view objects.
The three ways to achieve concurrency in iOS are :
 
* Threads
* Dispatch queues
* Operation queues
The different iOS application states are :
 
Not running state : when the app has not been launched or was running but was terminated by the system.

Inactive state : when the app is running in the foreground but is currently not receiving events. An app stays in this state briefly as it transitions to a different state. The only time it stays inactive is when the user locks the screen or the system prompts the user to respond to some event such as a phone call or SMS message.

Active state : when the app is running in the foreground and is receiving events. This is the normal mode for foreground apps.

Background state : when the app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time can remain in this state for some time. Also, an app being launched directly into the background enters this state instead of the inactive state.

Suspended state : A suspended app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.
Criteria Result
Type of operating system Apple proprietary based on Macintosh OS X
OS fragmentation Tightly integrated with Apple devices
Security Heightened security guaranteed
An unnamed category has fallen out of favor now that @protocol has been extended to support the @optional methods. Class Extensions @interface Foo() is designed to allow us to declare additional private API— system programming interface (SPI)—that is used to implement the class innards. This typically appears at the top of the .m file.

Any methods/properties declared in the class extension must be implemented in the @implementation, just like the methods/properties found in the public @interface. Class extensions can also be used to re-declare a publicly read-only @property as read-write prior to doing @synthesize on the accessors.

Example :
Foo.h
@interface Foo:NSObject
@property(readonly, copy) NSString *bar;
-(void) publicSaucing;
@end
Foo.m
@interface Foo()
@property(readwrite, copy) NSString *bar;
- (void) superSecretInternalSaucing;
@end
@implementation Foo
@synthesize bar;
.... must implement the two methods or compiler will warn ....
@end
* The UIKit framework is used to develop the application’s user interface. The UIKit framework provides event handling, drawing model, windows, views, and controls, specifically designed for a touch-screen interface.

* The UIKit framework (UIKit.framework) provides the crucial infrastructure needed to construct and manage iOS apps. This framework provides:

* Window and view architecture to manage an app’s user interface
* Event handling infrastructure to respond to the user input
* An app model to drive the main run loop and interact with the system
 
In addition to the core app behaviors, UIKit provides support for the following features :
 
* A view controller model to encapsulate the contents of the user interface
* Support for handling touch and motion-based events
* Support for a document model that includes iCloud integration
* Graphics and windowing support, including support for external displays
* Support for managing the app’s foreground and background execution
* Printing support
* Support for customizing the appearance of standard UIKit controls
* Support for text and web content
* Cut, copy, and paste support
* Support for animating user-interface content
* Integration with other apps on the system through URL schemes and framework interfaces
* Accessibility support for disabled users
* Support for the Apple Push Notification service
* Local notification scheduling and delivery
* PDF creation
* Support for using custom input views that behave like the system keyboard
* Support for creating custom text views that interact with the system keyboard
* Support for sharing content through Email, Twitter, Facebook, and other services
Unless it’s stated, use UIKit classes only from your application’s main thread or main dispatch queue. This restriction applies in particular to classes derived from UIResponder or that require modifying the user interface of your app in some way.
The structure of the iOS operating System is Layered based. Its communication doesn’t occur directly. The layer’s between the Application Layer and the Hardware layer will help for Communication. The lower level gives basic services on which all applications rely and the higher-level layers provide graphics and interface-related services. Most of the system interfaces come with a special package called a framework.
 
A framework is a directory that holds dynamic shared libraries like .a files, header files, images, and helper apps that support the library. Each layer has a set of frameworks that are helpful for developers.

CORE OS (or) Application Layer : All the IOS technologies are built under the lowest level layer i.e. Core OS layer. These technologies include:
 
* Core Bluetooth Framework
* External Accessories Framework
* Accelerate Framework
* Security Services Framework
* Local Authorization Framework etc.

It supports 64 bit which enables the application to run faster.
 
CORE SERVICES Layer : Some important frameworks are present in the CORE SERVICES Layer which helps the iOS operating system to cure itself and provide better functionality. It is the 2nd lowest layer in the Architecture as shown above. Below are some important frameworks present in this layer:
 
Address Book Framework : The Address Book Framework provides access to the contact details of the user.
Cloud Kit Framework : This framework provides a medium for moving data between your app and iCloud.
Core Data Framework : This is the technology that is used for managing the data model of a Model View Controller app.
Core Foundation Framework : This framework provides data management and service features for iOS applications.
Core Location Framework : This framework helps to provide the location and heading information to the application.
Core Motion Framework : All the motion-based data on the device is accessed with the help of the Core Motion Framework.
Foundation Framework : Objective C covering too many of the features found in the Core Foundation framework.
HealthKit Framework : This framework handles the health-related information of the user.
HomeKit Framework : This framework is used for talking with and controlling connected devices with the user’s home.
Social Framework : It is simply an interface that will access users’ social media accounts.
StoreKit Framework : This framework supports for buying of contents and services from inside iOS apps.

MEDIA Layer :  With the help of the media layer, we will enable all graphics video, and audio technology of the system. This is the second layer in the architecture. The different frameworks of MEDIA layers are:
 
ULKit Graphics : This framework provides support for designing images and animating the view content.
Core Graphics Framework : This framework support 2D vector and image-based rendering ad it is a native drawing engine for iOS.
Core Animation : This framework helps in optimizing the animation experience of the apps in iOS.
Media Player Framework : This framework provides support for playing the playlist and enables the user to use their iTunes library.
AV Kit : This framework provides various easy-to-use interfaces for video presentation, recording, and playback of audio and video.
Open AL : This framework is an Industry Standard Technology for providing Audio.
Core Images : This framework provides advanced support for motionless images.
GL Kit : This framework manages advanced 2D and 3D rendering by hardware-accelerated interfaces.

COCOA TOUCH Layer  : COCOA Touch is also known as the application layer which acts as an interface for the user to work with the iOS Operating system. It supports touch and motion events and many more features. The COCOA TOUCH layer provides the following frameworks :
 
EvenKit Framework : This framework shows a standard system interface using view controllers for viewing and changing events.
GameKit Framework : This framework provides support for users to share their game-related data online using a Game Center.
MapKit Framework : This framework gives a scrollable map that one can include in your user interface of the app.
PushKit Framework : This framework provides registration support.

Source :Geeksforgeeks
Let us discuss some features of the iOS operating system :
 
* Highly Securer than other operating systems.
* iOS provides multitasking features like while working in one application we can switch to another application easily.
* iOS’s user interface includes multiple gestures like swipe, tap, pinch, Reverse pinch.
* iBooks, iStore, iTunes, Game Center, and Email are user-friendly.
* It provides Safari as a default Web Browser.
* It has a powerful API and a Camera.
* It has deep hardware and software integration
There are the following iOS app lifecycle methods which are called when the app transitions from one state to another.
 
application: didFinishLaunchingWithOptions:-> Bool: when the application is launched initially, this method is called. We can do any initial setup for the application in this method like firebase configuration, user navigation, etc. The storyboard is loaded at this point, but we can maintain the state restoration.

applicationWillEnterForeground : this method is called after didFinishLaunchingWithOptions. It is also called when the application comes from background to foreground.

applicationDidBecomeActive : this method is called after applicationWillEnterForeground. If we need to perform any particular task when the app comes into the foreground, like font update, etc., then we can place the code in this method.

applicationWillResignActive : this method is notified when the application is about to become inactive. For example, the user receives a phone call; the user presses the home button, etc.).

applicationDidEnterBackground : this method is notified when the application goes into a background state after become inactive.

applicationWillTerminate : this method is called when the application is about to be finally terminated from memory. If we need to perform any final cleanups, then we can place the code in this method.
Model View Presenter (MVP) is a design pattern that separates the objects into three main components: Model, View, and Presenter. Now, the View Controller is considered as View, and the presenter contains all the business logic of the application.
 
View : The view consists of the View and View Controller. It contains only the view related code. It takes care of all the UI setup and events.

Presenter : The presenter contains all the business logic of the application. It defines the user actions and updates the UI accordingly via the delegate methods. It is not UIKit dependent and, therefore, easily testable.

Model : The model contains the application data. The networking calls, parser, extensions, manager, etc. take place here.
Properties are basically values that are associated with a class, struct, or enum.  They can be thought of as "sub-variables," i.e., parts of another object. 
 
Example :  
struct Icecream  
{ 
    var flavor: String = ""
} 
var choco = Icecream() 
choco.flavor = "Chocolate Icecream" 
 
In the above code, we created a structure called Icecream. One of its properties is called flavor, a String whose initial value is empty. 
 
Classification of Properties 
 
Stored Properties : This type of property can be used to store constant or variable values as instances and is usually provided by classes and structures.

Example :
class Programmer {
    var progName: String
    let progLanguage: String
    var totalExperience = 0
    var secondLanguage: String?
}
Above, the Programmer class defines four stored properties : progName, progLanguage, totalExperience, and secondLanguage. These are all stored properties since they can contain values that are part of the instance of the class. The above example shows properties with and without default values, as well as an optional one.
 
Computed properties : These properties can be used to calculate values instead of storing them and are usually provided by classes, enumerations, and structures.

Example :
struct Angle {
    var degrees: Double = 0

    var rads: Double {
        get {
            return degrees * .pi / 180
        }
        set(newRads) {
            degrees = newRads * 180 / .pi
        }
    }
}
As mentioned above, the angle structure has a stored property called degrees for storing angles in degrees. Moreover, angles can also be expressed in radians, so the Angle structure contains a Rads property, which is a computed property.
iBeacon.com defines iBeacon as Apple’s technology standard which allows Mobile Apps to listen for signals from beacons in the physical world and react accordingly. iBeacon technology allows Mobile Apps to understand their position on a micro-local scale, and deliver hyper-contextual content to users based on location. The underlying communication technology is Bluetooth Low Energy.
Every time : autorelease is sent to an object, it is added to the inner-most autorelease pool. When the pool is drained, it simply sends – releases to all the objects in the pool.

Autorelease pools are a convenience that allows you to defer sending - release until “later”. That “later” can happen in several places, but the most common in Cocoa GUI apps is at the end of the current run loop cycle.
Retain : specifies that retain should be invoked on the object upon assignment. It takes ownership of an object.

Assign : specifies that the setter uses simple assignment. It is used on attributes of scalar type like float, int.
Layer objects are data objects which represent visual content and are used by views to render their content. Custom layer objects can also be added to the interface to implement complex animations and other types of sophisticated visual effects.
The bundle ID is specified in Xcode, and it defines each App. A single project can have multiple targets and can output multiple apps. Use: it is branded multiple ways and has both free/lite and full/pro versions.
 
App ID is used to identify one or more apps from a single development team. It is a two-part string with a period(.) separating Team ID and bundle IF search string. The bundle ID search string is supplied by the developer, while Apple supplies the Team ID.  
The three different methods to reduce app size are :
 
* Bit code
* On-demand Resource
* App Slicing 
Atomic Property : It is the default property and ensures a valid value will be returned from the getter or set by the setter. This ensures that only one thread can access the getter/setter of a given property at a time and that all other threads must wait until the first thread releases the getter/setter. Despite being thread-safe, it is not fast, since it ensures that the process is completely completed.
 
Non-Atomic Property : With non-atomic properties, multiple threads can access the getter/setter method of a given property at the same time, so the potential for inconsistency between values exists. They come with enhanced access, but no guarantee of the return value.
The iOS operating system has some advantages over other operating systems available in the market especially the Android operating system. Here are some of them-
 
* More secure than other operating systems.
* Excellent UI and fluid responsive
* Suits best for Business and Professionals
* Generate Less Heat as compared to Android.
Let us have a look at some disadvantages of the iOS operating system :
 
* More Costly.
* Less User Friendly as Compared to Android Operating System.
* Not Flexible as it supports only IOS devices.
* Battery Performance is poor.
Synchronous can also be defined as In order. When you perform the synchronous operation, all that follows must wait for the operation to complete before proceeding.

In contrast, “asynchronous” can also be defined as “out of order.” When you do something asynchronously, you can run the following code right away, and the asynchronous process will happen someday. It could be run on a separate thread from the rest of the code. It could easily be rescheduled on the same thread at a later date and you can notify you when it is done.
State transitions can be responded to state changes in an appropriate way by calling corresponding methods on the app’s delegate object.
 
For example :
 
* applicationDidBecomeActive( ) method : To prepare to run as the foreground app

* applicationDidEnterBackground( ) method : To execute some code when the app is running in the background that may be suspended at any time

* applicationWillEnterForeground( ) method : To execute some code when the app is moving out of the background

* applicationWillTerminate( ) method : Called when the app is being terminated
TVMLKit serves as a bridge between TVML, JavaScript, and your native tvOS software. You can test TVMLKit JS and TVML files from inside your tvOS app using the TVMLKit framework. The JavaScript environment can be used to build TVML objects, styles, views, and view controllers.
The following features are added in iOS 9 :
 
* Intelligent search : It is an excellent mechanism to learn user habits and act on that information—open apps before we need them, make recommendations on places we might like, and guide us through our daily lives to make sure we’re where we need to be at the right time.

* Siri : It is a personal assistant to the users that is able to create contextual reminders and search through photos and videos in new ways. Swiping right from the home screen brings up a new screen that houses ‘Siri Suggestions,’ putting favorite contacts and apps right on our fingertips, along with nearby restaurant and location information and important news.

* Deeper search capabilities : It can show results such as sports scores, videos, and content from third-party apps, and we can even do simple conversions and calculations using the search tools on our iPhone or iPad.

* Performance improvements : The following built-in apps have been improved:

* Notes including new checklists and sketching features
* Maps now offering transit directions
* Mail allowing for file attachments
* New ‘News’ app that learns our interests and delivers relevant content we might like to read
* Apple Pay being improved with the addition of store credit cards and loyalty cards
* ‘Passbook’ being renamed to ‘Wallet’ in iOS 9

* San Francisco font

* Wireless CarPlay support

* Optional iCloud Drive app: It is a built-in two-factor authentication system with optional longer passwords for better security.
There are three types of a queue available for GCD.
 
Main Queue : the main queue runs on the main thread, and it performs the serial execution of the thread.

Global Queue : The Global queue is a concurrent queue and shared by the whole system. There are four global queues that operate on different priorities. The priorities are high, default, low, and background, where the background priority queue holds the minimum priority.

Custom Queue : the developer creates the custom queues. They can be either concurrent or serial.
There are the following categories of QoS classes present in the system.
 
User Interactive : When we launch an application in iOS, to get a nice user experience, we need some tasks to be executed immediately. Such tasks are user interactive, which are to be executed for nice user experience. As a developer, we must use these tasks for UI Updates, event handling, and small workloads. The user-interactive tasks need to be executed on the main thread.

User-Initiated : These tasks are initiated by the user from the user interface. These are asynchronous tasks that are to be used when the user waits in the application for immediate results, such as some API calls. The user-initiated tasks are executed in the high priority global queue.

Utility : these are long-running tasks that run typically with a progress indicator. These types of threads are used for networking, computations, I/O, etc. These tasks are executed in the low priority global queue.
To parse the response in Alamofire API request, we will use JSONDecoder, which is an object that decodes instances of a data type from JSON objects.
 
The decode method of JSONDecoder is used to decode the JSON response. It returns the value of the type we specify, decoded from a JSON object. The syntax is given below.
func decode<T>(T.Type, from: Data) -> T
To save the data in the UserDefaults, first, we need to get the reference to the UserDefaults by using the standard property.
UserDefaults.standard  
The following code can be used to save a string in the UserDefaults.
let token = "ABCDEFGD!@#$456MK"    
UserDefaults.standard.set(token, forKey: "userToken")    
To remove any value from the UserDefaults, the removeObject() method is used. Here, we want to remove the value for key userToken, we can write the following code.
UserDefaults.standard.removeObject(forKey : "userToken ")   
Apple provides us the UIRefreshControl class, which simplifies adding the pull to refresh. The First thing we need to do is instantiate the UIRefreshControl class.
let refreshControl = UIRefreshControl()    
Here, we need to add this refresh control to our view. We can assign the refreshControl property of the view to this instance. However, we must notice that, before iOS 10, there was not a property like refreshControl. We had to add it as a sub view to the view.
if #available(iOS 10.0, *) {    
    tableView.refreshControl = refreshControl    
}     
else {    
    tableView.addSubview(refreshControl)    
}    
Android : It is the mobile operating system for Android devices offered by Google LLC (limited liability company) and is focused on touchscreen mobile devices like smartphones and tablets. Several programming languages were used in its development, including C, Java, C++, and others. 
 
iOS : It is the operating system for Apple devices offered by Apple incorporation and it is considered the second most popular mobile operating system globally after Android. It is primarily designed for Apple mobile devices like the iPhone, iPod Touch, etc. Several programming languages were used in its development, including Objective-C, Swift, C++, and others.

Android iOS
It is the mobile operating system for Android devices offered by Google LLC (limited liability company).  It is the operating system for Apple devices offered by Apple incorporation.
It is specially designed for smartphones, tablets.  It is specially designed for Apple iPhones, iPods, and iPads. 
It is mainly written in C, C++, Java and other languages.  It is mainly written in C, C++, Objective-C, Swift, and other languages.  
On Android devices, Google Chrome is the default internet browser. However, any other browser can be installed.   Safari is the default Internet browser on iOS devices. However, any other browser can be installed. 
The Android software is available for many manufacturers including Samsung, LG, etc., which could cause some quality issues in cheaper phones.  Apple has strict quality control over iOS and there are no quality problems.  
Contrary to this, the performance of Android devices may deteriorate over time.  iOS devices run at a consistent speed over time. 
In contrast, Android devices have open-source code, meaning that owners can alter their phones and tablets operating systems at their discretion. If owners tinker (change/modify) with their devices too much, they could weaken their devices' security. iOS is a closed system. The source code of Apple's apps isn't available for developers, and iPhone and iPad owners can't modify the code on their devices. This makes iOS-powered devices harder to hack.
Deep links are links that send users directly to an app directly instead of a website or store using URI (Uniform resource locator) or universal links. The URL scheme is a well-known method of having deep links, but Universal Links are Apple's new approach to connecting your web page and your app under the same link. Deep linking involves not only creating a clickable link that opens up your app, but also a smart one that navigates to the resource you desire. Users are directed straight to in-app locations using these links, which saves them the time and effort of finding those pages themselves thus improving their user experience tremendously. 
In the Swift programming language, automatic reference counting (ARC) is used to manage apps' memory usage. It initializes and deinitializes system resources, thereby releasing memory reserved by a class instance when it no longer needs it. ARC keeps track of how many properties, constants, and variables currently refer to each class instance. When there is at least one active reference to an instance, ARC will not deallocate that instance. The use of ARC concepts is an essential part of iOS development.  
 
Functions of ARC :
 
* ARC creates a new class instance using init() and allocates a chunk of memory to store the information.
* Memory stores information about the instance type and its values.
* As soon as the class instance is no longer required, ARC automatically frees memory by calling deinit().
* By tracking current referring classes' properties, constants, and variables, ARC ensures that deinit() is only applied to those instances that are unused.
iOS development is done using the following programming languages : 
 
* HTML5
* .NET
* C
* C++
* Swift
* Javascript
* Objective-C.
Process :
 
* Process is a heavy weight process.
* Process is a separate program that has separate memory,data,resources ect.
* Process are created using fork() method.
* Context switch between the process is time consuming.

Example : Say, opening any browser (mozilla, Chrome, IE). At this point new process will start to execute.
 
Threads :
 
* Threads are light weight processes.Threads are bundled inside the process.
* Threads have a shared memory,data,resources,files etc.
* Threads are created using clone() method.
* Context switch between the threads are not much time consuming as Process.
First, tvOS provides no browser support of any kind, nor is there any WebKit or other web-based rendering engine you can program against. This means your app can’t link out to a web browser for anything, including web links, OAuth, or social media sites.
 
Second, tvOS apps cannot explicitly use local storage. At product launch, the devices ship with either 32 GB or 64 GB of hard drive space, but apps are not permitted to write directly to the onboard storage.
 
tvOS app bundle cannot exceed 4 GB.
Cocoa and Cocoa Touch are two of Apple's widely used application frameworks used for building applications. However, they differ in the following ways : 

Cocoa Cocoa Touch
It is an application framework for building applications that run on Mac OS X.  It is the application framework for building applications that run on devices like iPhones and iPad. 
Frameworks such as Foundation and AppKit are incorporated into Cocoa.   Cocoa Touch is a combination of Frameworks such as Foundation and UIKit are incorporated into Cocoa Touch. 
Cocoa classes use the NS (used for all classes and constants in the cocoa framework) prefix (like NSTextField, NSWindow).  Cocoa Touch classes, on the other hand, use the UI (used for all classes and constants in the cocoa touch framework) prefix (like UITextField and UIWindow). 
Managed Object Model can be defined as the set of objects that are used to form a blueprint describing the managed object we use in our application. In other words, the Managed object model can be seen as a schema that the CoreData uses.
 
It is an instance of NSManagedObjectModel class. However, the Managed Object Model includes the application's entities, the properties, and the relationship between them.
Content ViewControllers are the main type of View Controllers that we create. The Content View Controllers holds the content of the Application screen. In other words, we can say that the Content View Controller manages the discrete piece of the application content. The Content ViewController manages all the Views itself.
Container ViewController is different from content ViewController in the sense that it acts as a parent View Controller, which collects information from the child view controllers. The task of the container view controller is to present the collected information to facilitate the navigation to the child view controllers. The container ViewController only manages the RootView, which incorporates one or more Child ViewControllers.
KVC (Key-Value Coding) is a method for accessing an object’s properties using strings at runtime rather than needing to know the property names statically at development time.
 
KVO (Key-Value Observing) allows a controller or class to monitor changes in a property value. In KVO, an object may request to be informed of any adjustments to a particular property, and the observer is automatically notified if that property’s value changes.
* To handle all of the work, only a small amount of code is needed.
* Available in both Object C and Swift.
* SQLite and Core Data have slower performance.
* Database files can be shared easily between iOS and Android devices.
* There is no fee, no charge.
* There is no limit to the data amount that can be stored.
* Regardless of huge data sets or massive storage, consistent speed and consistency
A UIView’s bounds are a rectangle with a size (width, height) and position (x,y) relative to its own coordinate system (0,0).
 
A UIView’s frame is a rectangle with a scale (width, height) and position (x,y) relative to the superview it is located within.
Mainly, there are 3 ways to achieve concurrency in iOS. There are :
 
* Threads
* Grand Central Dispatch
* OperationQueue
Strong : Through the life of the object, the reference count will be increased and the reference will be maintained

Weak : It can be said as a non-strong reference that means it refers to the fact that we are referring to an object but not adding to its reference count. It’s often used to establish a parent-child relationship. The parent has a strong connection with the infant, but the child has only a small connection with the parent.

Read-only : Initially, The property will be set and it can’t be changed.

Copy : It means that when an object is created, we’re copying its value. Also prevents its value from changing.
Property list or plist refers to a list that organizes data into named values and lists of values using several object types. These types provide us the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. Property lists are frequently used by applications running on both Mac OS X and iOS. The property-list programming interfaces for Cocoa and Core Foundation allow us to convert hierarchically structured combinations of these basic types of objects to and from standard XML. We can save the XML data to the disk and later use it to reconstruct the original objects.
 
The user defaults system, which we programmatically access through the NSUserDefaults class, uses property lists to store objects representing user preferences. This limitation would seem to exclude many kinds of objects, such as NSColor and NSFont objects, from the user defaults system. However, if objects conform to the NSCoding protocol, they can be archived to NSData objects, which are property-list-compatible objects.
Cocoa doesn't provide anything called abstract. It can create a class abstract that gets checked only at the runtime while it is not checked at the compile time.
@interface AbstractClass : NSObject
@end
@implementation AbstractClass
+ (id)alloc{
if (self == [AbstractClass class]) {
NSLog(@"Abstract Class can’t be used");
}
return [super alloc];
@end
SpriteKit : This framework is designed to make it easier and faster for game developers to create animated 2D assets/objects in casual games. With it, you can draw shapes, particles, text, images, and videos in two dimensions. 
 
SceneKit : It is an iOS framework inherited from OS X, which helps to create 3D graphics. With SceneKit, you can build 3D animated scenes and effects for your iOS games and apps.
Since the 1990s, Objective-C has been used by Apple as an object-oriented programming language. This language combines the advantages of two earlier languages - C and Smalltalk. As a superset of C, it provides object-oriented functionality and a dynamic runtime environment. 
 
Features :
* It is easy to understand.
* In Objective C, meta classes are automatically created and managed during runtime.
* Dynamic typing and static typing are both supported.
 
Following are data types that the developers mostly use in Objective – C : 
 
BOOL : Represents a Boolean value that is either true or false. Both the _Bool or BOOL keywords is valid.
Example :
_Bool flag = 0;
BOOL secondflag = 1;
 
NSInteger : Represents an Integer.
Example :
typedef long NSInteger;
typedef int NSInteger;
 
NSUInteger : Represents an unsigned integer.
Example :
typedef unsigned long NSUInteger; 
typedef unsigned int NSUInteger;

NSString :
Represents a string.
Example :
NSString *greeting = @"Hello";
Lazy properties are properties whose initial value isn't computed until the first time they are used. Including the lazy modifier/keyword before the declaration of a stored property indicates it is lazy. This lets you delay the initialization of stored properties. This could be a great way to streamline your code and reduce unnecessary work. When a code is expensive and unlikely to be called consistently, a lazy variable can be a great solution. 
 
Example : 
class Person { 
var name: String
lazy var personalizdgreeting : String = {  
      return “HelloScala \(self.name)!”  
}() 
init(name: String) { 
           self.name = name 
            } 
}
 
As shown above, we aren't sure what value personalizedgreeting should have. To know the correct greeting for this person, we need to wait until this object is initialized.
@synthesize : This command generates getter and setter methods within the property and works in conjunction with the @dynamic command. By default, @synthesize creates a variable with the same name as the target of set/get as shown in the below example.

Example1 :
@property (nonatomic, retain) NSButton *someButton;
...
@synthesize someButton;
 
It is also possible to specify a member variable as its set / get target as shown below:

Example2 :
@property (nonatomic, retain) NSButton *someButton;
...
@synthesize someButton= _homeButton;
Here, the set / get method points to the member variable _homeButton.

@dynamic : This tells the compiler that the getter and setter methods are not implemented within the class itself, but elsewhere (like the superclass or that they will be available at runtime). 
Example :
@property (nonatomic, retain) IBOutlet NSButton *someButton;
...
@dynamic someButton;
SN Method Signature Description
1 func textFieldShouldBeginEditing(UITextField) -> Bool It asks the delegate if editing should begin the respective textfield.
2 func textFieldDidBeginEditing(UITextField) It tells the delegate that the editing is started in the textfield.
3 func textFieldShouldEndEditing(UITextField) -> Bool It asks the delegate to end the editing in the textfield.
4 func textFieldDidEndEditing(UITextField, reason: UITextField.DidEndEditingReason) It tells the delegate that the editing has been stopped for the specified textfield.
5 func textFieldDidEndEditing(UITextField) It is the overloaded methods which also does the same as the above.
6 func textField(UITextField, shouldChangeCharactersIn: NSRange, replacementString: String) -> Bool It asks the delegate that if the text field's current content should be changed.
7 func textFieldShouldClear(UITextField) -> Bool It asks the delegate if the text field's current content should be removed.
XIB stands for an XML interface builder. The interface builder allows us to develop graphical user interfaces with the help of cocoa and carbon. XIB files are loaded at the runtime to provide the user interface for the application. The XIB files are stored as NIB or XIB files, which represent UIView.
There are several activities that are performed by the views in the iOS application.
 
* Drawing and animation
* By using views, we can draw into the rectangular area of the screen.

* Layout and Sub view management
* We can embed one or more subviews into the UIView. The appearance of the subviews can be managed by managing the appearance of the super view.
* We can define the auto-layout rules to govern the size and positioning of the view hierarchy on different iOS devices.

* Event Handling
* A view can respond to the touch and another kind of event since it is the subclass of UIResponder.
* We can add the gesture recognizers for the uiview, such as UITapGestureRecognizer.
To maintain the data to be displayed by the tableview, we need to maintain a DataSource object that implements the UITableViewDataSource protocol. The datasource object manages the tableview data. The datasource object performs the following main tasks.
 
* It reports the number of rows and sections to be displayed in the tableview.
* It allocates the reusable cells for each row in the tableview.
* It provides the titles for headers and footers in the tableview sections.
The tableview delegate methods are defined to add the following features to the tableview.
 
* We can create the custom headers and footers for the sections in the tableview.
* We can specify the custom heights for rows, headers, and footers.
* Provide height estimates for the rows, headers, and footers.
* We can define the method which can handle the row selections.
The following two DataSource methods are necessary to implement for using tableview.

1 func tableView(UITableView, numberOfRowsInSection: Int) -> Int This method returns the number of rows to be displayed in the section of the tableview.
2 func tableView(UITableView, cellForRowAt: IndexPath) -> UITableViewCell This method returns the object of a UITableViewCell, which shows the actual content of a particular row in the tableview. This method inserts the cell for a particular row in the tableview.
To provide the height of tableview according to the content height, return UITableView.automaticDimension in heightForRowAt delegate method. Consider the following syntax.
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {    
      return UITableView.automaticDimension    
  }  
The Singleton design pattern ensures that only one instance exists for a given class and that there’s a global access point to that instance. It usually uses lazy loading to create the single instance when it’s needed the first time.
The Facade design pattern provides a single interface to a complex subsystem. Instead of exposing the user to a set of classes and their APIs, you only expose one simple unified API.
The Decorator pattern dynamically adds behaviors and responsibilities to an object without modifying its code. It’s an alternative to subclassing where you modify a class’s behavior by wrapping it with another object.
 
In Objective-C there are two very common implementations of this pattern: Category and Delegation. In Swift there are also two very common implementations of this pattern: Extensions and Delegation.
Persistence means storing data on the disk so that it can be retrieved without being altered the next time the app is opened. From simple to complex, there are the following methods for storing data : 
 
* Data structures such as arrays, dictionaries, sets, and other data structures are perfect for storing data intermediately.
* NSUserDefaults and Keychains are both simple key-value stores. NSUserDefaults is insecure, whereas Keychains is secure.
* A file or disk storage is a way to store data (serialized or not) to or from a disk using NSFileManager.
* Relational databases, such as SQLite, are good for implementing complex querying mechanisms.
Xcode is Apple’s integrated development environment (IDE) that you use to design apps for Apple products.  It provides various tools to manage your entire development workflow from creating your app, to testing, submitting and optimizing it to the App store.
To add frameworks in Xcode project
 
* Choose the project file from the project navigator on the left side of the project window

* Choose the target where you want to add frameworks in the project settings editor

* Choose the “Build Phases” tab, and select the small triangle next to “Link Binary With Libraries” to view all of the frameworks in your application

* To add frameworks click on “+” sign below the list of frameworks

* To choose multiple frameworks, press and hold the command key while choosing the framework
In Xcode 6,  new features include
 
Support for Swift : Xcode 6 explicitly supports the Swift code, it is very simple and easy to make a brand new app using 100% swift code to existing frameworks.

Playgrounds : It enables the interactive experience of a scripting language, like you can show variables in a graph, watch an animated SpriteKit Scene or inspect each step when drawing a view. Once you are done with code in the playground, you can move it into your project

Command Line : You can use Swift syntax to interact and evaluate with your running app or write new code in a script like environment

Performance Testing : The XCTest framework is extended to support performance test, and is completely synchronized with Xcode and Xcode Server. It also raises alerts for regression when test results change

View Debugging : Xcode allows easy debugging and includes new debugging tools like debug gauges to monitor I/O usage and enhance iCloud gauge
We can use generated code like nonatomic, atomic, retain without writing any lines of code. We also have getter and setter methods. To use this, you have 2 other ways: @synthesize or @dynamic: @synthesize, the compiler will generate the getter and setter automatically for you, @dynamic: you have to write them yourself.@property is really good for memory management, for example: retain.How can you do retain without @property?
if (_variable != object)
{
[_variable release];
_variable = nil;
_variable = [object retain];
}
How can you use it with @property?self. variable = object; When we are calling the above line, we actually call the setter like [self setVariable:object] and then the generated setter will do its job.
For security reasons, iOS places each app (including its preferences and data) in a sandbox at install time. A sandbox is a set of fine-grained controls that limit the app’s access to files, preferences, network resources, hardware, and so on. As part of the sandboxing process, the system installs each app in its own sandbox directory, which acts as the home for the app and its data.
 
To help apps organize their data, each sandbox directory contains several well-known subdirectories for placing files. The above Figure shows the basic layout of a sandbox directory.
Well, you would want to implement the getter and setter for the title object. Something like this: view source print?
– (NSString*) title // Getter method
  {
    return title;
  }
– (void) setTitle: (NSString*) newTitle //Setter method
  {
    if (newTitle != title)
  {
    [title release];
    title = [newTitle retain]; // Or copy, depending on your needs.
   }
  }
A CollectionView can also present the data using the supplementary views as well. The supplementary views are the section headers and footers that are configured using the UICollectionViewDelegate methods. Support for supplementary views can be defined by the collection view layout object. The collection view layout object also defines the placement of those views.
The collection view DataSource object is responsible for providing the data that is required by the collectionview. It is like the collectionview application's data model. It passes the data to the collectionview that is to be displayed.
 
On the other hand, CollectionView Delegate object handles the selection, deselection, highlighting the items in the collectionview.
If the size of the image is smaller than the imageview, than any transparency in the image leads to the background display through since the image is composited onto the imageview background and then onto the rest of the available image.
 
* If the image view's isOpaque property is true, the image's pixels are composited on top of the image view's background color, and the alpha property of the image view is ignored.
 
* If the image view's isOpaque property is false, the alpha value of each pixel is multiplied by the image view's alpha value, with the resulting value becoming the actual transparency value for that pixel. If the image does not have an alpha channel, the alpha value of each pixel is assumed to be 1.0.
The MapView is the object that can display an embeddable map interface in the iOS applications. It is similar to the one that is provided by the Maps applications. It is an instance of the MKMapView class, which inherits the UIView class.
class MKMapView : UIView 
For this purpose, Tab Bar Controllers are used. It is a container view controller that manages an array of view controllers in a radio-style selection interface so that the user can interact with the interface to determine the view controller to display. It is the instance of UITabBarController, which inherits UIViewController.
class UITabBarController : UIViewController  
In the tab bar interface, a tab bar is displayed at the bottom of the screen with multiple tab bar button items for selecting between different modes of the application
A TabBar is a control that is used to display and configure one or more bar button items in a tab bar for selecting between different subtasks, views, or modes in the iOS application. The TabBar is used in association with the TabBarController to present the list of tabs in the application. However, we can use the tab bar as stand-alone control in the application. The Tab Bar is the instance of the UITabBar class, which inherits UIView.
class UITabBar : UIView   
The tab bar always appears across the bottom edge of the screen. A UITabBar object contains one or more UITabBarItem objects. However, we can customize the appearance of the Tab Bar by changing its background color, image, or tint color according to the interface. When we use the UITabBarController object, we are provided with an in-built UITabBar object that can be customized using interface builder or programmatically.
StackView is useful to manage a UI which requires views to be added or removed at runtime based on a certain user event. It simplifies the task to layout a series of views (horizontally and vertically) by managing the spacing among the views. We won't need to change, add, or remove constraints for the inner views at runtime. We only need to provide constraints to stackview.
Jailbreaking enhances the possibility of installing software that can unofficially unlock carrier-locked iPhones. The unlocked carrier-locked iPhones can be used with other carriers as well.
 
Jailbreaking also allows the installation of pirated software on iOS. However, such applications are not available through the App Store. Consumer software is restricted to be installed using App Store, such software can be installed via jailbreaking.
FaceTime
 
* Spatial audio makes people’s voices sound like they’re coming from the direction in which they’re positioned on the screen on Group FaceTime calls (iPhone XS, iPhone XS Max, iPhone XR and later)
* Voice Isolation blocks background noises so your voice is crystal clear (iPhone XS, iPhone XS Max, iPhone XR and later)
* Wide Spectrum brings all background noises into your call (iPhone XS, iPhone XS Max, iPhone XR and later)
* Portrait mode blurs your background and puts the focus on you (iPhone XS, iPhone XS Max, iPhone XR and later)
* Grid view displays up to six people at a time in Group FaceTime calls in the same-size tiles and highlights the current speaker
* FaceTime links allow you to invite your friends into a FaceTime call, even friends on Android or Windows devices can join from their browser

Messages and Memoji
 
* Shared with You shows content sent to you by friends in Messages conversations in a new section in Photos, Safari, Apple News, Apple Music, Apple Podcasts, or the Apple TV app
* Pinned content elevates the shared content you choose and makes it more prominent in Shared with You, Messages search, and the Details view of the conversation
* Multiple photos sent in Messages are displayed as a glanceable collage or a swipeable stack
* Over 40 Memoji outfit choices and up to three different colors to customize your Memoji stickers’s clothing and headwear

Focus
 
* Focus lets you automatically filter notifications based on what you’re currently doing, such as fitness, sleep, gaming, reading, driving, work, or personal time
* Focus uses on-device intelligence during set up to suggest apps and people you want to allow notifications from in a Focus
* Home Screen pages can be customized to match your apps and widgets to a specific Focus
* Contextual suggestions intelligently suggest a Focus based on your context, using signals like location or time of day
* Status appears to your contacts in Messages conversations, indicating your notifications are silenced with Focus

Notifications
 
* A new look displays contact photos for people and larger icons for apps
* Notification summary delivers a helpful collection of your notifications daily, based on a schedule you set
* Notifications can be muted from any app or messaging thread for the next hour or for the day

Maps
 
* Detailed city maps display elevation, trees, buildings, landmarks, crosswalks and turn lanes, and 3D views to navigate complex interchanges, and more in San Francisco Bay Area, Los Angeles, New York, and London, with more cities coming in the future (iPhone XS, iPhone XS Max, iPhone XR and later)
* New driving features include a new map that highlights details like traffic and incidents, and a route planner that lets you view your upcoming journey by choosing a future departure or arrival time
* Immersive walking directions show step-by-step directions in augmented reality (iPhone XS, iPhone XS Max, iPhone XR and later)
* Updated transit experience provides one-tap access to departures near you, makes it easy to see and interact with your route using one hand, and notifies you when approaching your stop
* Interactive 3D globe shows enhanced details for mountain ranges, deserts, forests, oceans, and more (iPhone XS, iPhone XS Max, iPhone XR and later)
* Redesigned place cards make it easy to learn about and interact with places, and a new home for Guides editorially curates the best recommendations for places you’ll love

Safari
 
* Bottom tab bar is easier to reach and helps you move between tabs by swiping left or right
* Tab Groups help you save and organize your tabs and easily access them across devices
* Tab overview grid view displays your open tabs 
* Start page can be customized with a background image and new sections like Privacy Report, Siri Suggestions, and Shared With You
* Web extensions on iOS help you personalize your browsing and can be downloaded through the App Store
* Voice search lets you search the web using your voice

Wallet
 
* Home keys let you tap to unlock a supported home or apartment door lock (iPhone XS, iPhone XS Max, iPhone XR and later)
* Hotel keys allow you to tap to unlock your room at participating hotels
* Office keys allow you to tap to unlock your office doors for participating corporate offices
* Car keys with Ultra Wideband help you unlock, lock, and start your supported car without having to take your iPhone out of your bag or pocket (iPhone 11 and iPhone 12 models)
* Remote keyless entry functions on your car keys allow you to lock, unlock, honk your horn, preheat your car, or open your trunk on your supported vehicle

Live Text
 
* Live Text makes text interactive in your photos so you can copy and paste, look up, and translate in Photos, Screenshot, Quick Look, Safari, and live previews with Camera (iPhone XS, iPhone XS Max, iPhone XR and later)
* Data detectors for Live Text recognize phone numbers, emails, dates, street addresses, and more in photos so you can take action on them
* Live Text is available from the keyboard letting you insert text directly from the camera viewfinder into any text field

Spotlight
 
* Rich results brings together all the information you’re looking for on contacts, actors, musicians, movies, and TV shows
* Photos can be searched from your photo library by locations, people, scenes, text in the photos or other things in the photos, like a dog or a car
* Web image search allows you to search for images of people, animals, monuments, and more

Photos
 
* New look for Memories with a new interactive interface, animated cards with smart, adaptive titles, new animation and transition styles, and multiple image collages 
* Apple Music can be added to your Memories for Apple Music subscribers, and personalized song suggestions combine expert recommendations with your music tastes and what’s in your photos and videos
* Memory mixes let you set the mood by selecting from different songs and a Memory look to match
* New memory types include additional international holidays, child-focused memories, trends over time, and improved pet memories
* Info pane now displays rich information about the photo like which camera and lens, shutter speed, file size, and more
* Visual Look Up recognizes art, landmarks around the world, plants and flowers, books, and dog and cat breeds in your photos so you can learn more about them

Health
 
* Sharing lets you choose health data, alerts, and trends to share with people important to you or those who are caring for you, including your healthcare provider
* Trends lets you see how a given health metric is progressing over time and can notify you when a new trend has been detected
* Walking Steadiness is a new metric that can assess your risk of falling and notify you if your walking steadiness is low (iPhone 8 and later)
* Verifiable health records enable you to download and store verifiable versions of COVID-19 vaccines and lab results
* Lab results can now be pinned for quick access and include highlights that show how your labs have changed over time

Weather
 
* A new design shows the most important weather information for that location and includes new maps modules
* Weather maps can be viewed in full-screen and show precipitation, temperature and air quality in supported countries
* Next-hour precipitation notifications alert you when rain or snow is about to start or stop in Ireland, U.K., and US
* New animated backgrounds more accurately represent the sun position, clouds, and precipitation (iPhone XS, iPhone XS Max, iPhone XR and later)

Siri
 
* On-device processing means audio of your requests does not leave your device by default, and means Siri is able to process many requests while offline (iPhone XS, iPhone XS Max, iPhone XR and later)
* Share items with Siri lets you send on screen items like photos, web pages and Maps locations to any of your contacts
* Onscreen context can be used by Siri to refer to contacts on screen to send them a message or place a call
* On-device personalization allows Siri speech recognition and understanding to improve privately (iPhone XS, iPhone XS Max, iPhone XR and later)

Privacy
 
* Mail Privacy Protection protects your privacy by preventing email senders from learning about your Mail activity, your IP address or whether you've opened their email
Safari Intelligent Tracking Prevention now also prevents known trackers from profiling you using your IP address

iCloud+
 
iCloud+ is a cloud subscription service that gives you premium features and additional iCloud storage
iCloud Private Relay (beta) sends your requests through two separate internet relays and encrypts the internet traffic leaving your device so you can browse Safari in a more secure and private way
Hide My Email lets you create unique, random email addresses that forward to your personal inbox so you can send and receive email without having to share your real email address
HomeKit Secure Video supports connecting more security cameras without using your iCloud storage quota
Custom email domain personalizes your iCloud Mail address and allows you to invite family members to use the same domain

Accessibility
 
* Image exploration with VoiceOver allows you to get even more details about people and objects, and learn about text and table data in photos
* VoiceOver image descriptions in Markup let you add your own image descriptions that can be read by VoiceOver
* Per-app settings allow you to customize display and text size settings only for the apps you want
* Background sounds play balanced, bright, or dark noise, ocean, rain, and stream sounds continuously in the background to mask unwanted environmental or external noise
* Sound actions for Switch Control enable you to control your iPhone with simple mouth sounds
* Audiograms can be imported in Settings so you can customize Headphone Accommodations based on your hearing test results etc,.
iOS 15.1 adds SharePlay, an entirely new way to have shared experiences with family and friends in FaceTime. This release also adds the ability to capture ProRes video using iPhone 13 Pro and iPhone 13 Pro Max, as well as verifiable COVID-19 vaccination cards in Apple Wallet, and includes other features and bug fixes for your iPhone.
 
SharePlay
 
* SharePlay is a new way to share synchronized experiences in FaceTime with content from the Apple TV app, Apple Music, Fitness+, and other supported App Store apps
* Shared controls give everyone the ability to pause, play, rewind or fast forward
* Smart volume automatically lowers the audio of a movie, TV show or song when your friends speak
* Apple TV supports the option to watch the shared video on your big screen while you continue the FaceTime call on iPhone
* Screen sharing lets everyone on a FaceTime call look at photos, browse the web, or help each other out

Camera
 
* ProRes video capture using iPhone 13 Pro and iPhone 13 Pro Max
* Setting to turn off automatic camera switching when taking macro photos and videos on iPhone 13 Pro and iPhone 13 Pro Max

Apple Wallet
 
* COVID-19 vaccination card support allows you to add and present verifiable vaccination information from Apple Wallet

Translate
 
* Mandarin Chinese (Taiwan) support in the Translate app and for system-wide translation

Home
 
* New automation triggers based on the current reading of a HomeKit-enabled humidity, air quality, or light level sensor

Shortcuts
 
* New pre-built actions let you overlay text on images or gifs, plus a new collection of games lets you pass the time with Siri

This release also fixes the following issues :
 
* Photos app may incorrectly report storage is full when importing photos and videos
* Weather app may not show current temperature for My Location, and may display colors of animated backgrounds incorrectly
* Audio playing from an app may pause when locking the screen
* Wallet may unexpectedly quit when using VoiceOver with multiple passes
* Available Wi-Fi networks may not be detected
* Battery algorithms updated on iPhone 12 models to better estimate battery capacity over time
iOS 15.5 includes enhancements to Apple Cash, Apple Podcasts, and other features and bug fixes.
 
iOS 15.5 includes the following improvements and bug fixes :
 
* Wallet now enables Apple Cash customers to send and request money from their Apple Cash card
* Apple Podcasts includes a new setting to limit episodes stored on your iPhone and automatically delete older ones
* Fixes an issue where home automations, triggered by people arriving or leaving, may fail
* Fixes an issue that may cause iPhone SE (3rd gen) to unexpectedly shutdown