Vous êtes sur la page 1sur 73

1- How could you setup Live Rendering ?

The attribute @IBDesignable lets Interface Builder perform live

updates on a particular view.

2- What is the difference between Synchronous &

Asynchronous task ?
Synchronous: waits until the task has
completed Asynchronous: completes a task in background
and can notify you when complete

3- What Are B-Trees?

B-trees are search trees that provide an ordered key-value store
with excellent performance characteristics. In principle, each
node maintains a sorted array of its own elements, and another
array for its children.

4- What is made up of NSError object?

There are three parts of NSError object a domain, an error code,
and a user info dictionary. The domain is a string that identifies
what categories of errors this error is coming from.

5- What is Enum ?

Enum is a type that basically contains a group of related values

in same umbrella.

6- What is bounding box?

Bounding box is a term used in geometry; it refers to the
smallest measure (area or volume) within which a given set of

7- Why don’t we use strong for enum property in

Objective-C ?
Because enums aren’t objects, so we don’t specify strong or
weak here.
8- What is @synthesize in Objective-C ?
synthesize generates getter and setter methods for your

9- What is @dynamic in Objective-C ?

We use dynamic for subclasses of NSManagedObject.
@dynamic tells the compiler that getter and setters are
implemented somewhere else.

10- Why do we use synchronized ?

synchronized guarantees that only one thread can be executing
that code in the block at any given time.

11- What is the difference strong, weaks, read only and

copy ?
strong, weak, assign property attributes define how memory for that
property will be managed.

Strong means that the reference count will be increased and

the reference to it will be maintained through the life of the

Weak ( non-strong reference ), means that we are pointing

to an object but not increasing its reference count. It’s often
used when creating a parent child relationship. The parent has a
strong reference to the child but the child only has a weak
reference to the parent.
• Every time used on var
• Every time used on an optional type
• Automatically changes itself to nil

Read only, we can set the property initially but then it can’t be
Copy, means that we’re copying the value of the object when it’s
created. Also prevents its value from changing.

for more details check this out

12- What is Dynamic Dispatch ?

Dynamic Dispatch is the process of selecting which
of a polymorphic operation that’s a method or a function to call
at run time. This means, that when we wanna invoke our
methods like object method. but Swift does not default to
dynamic dispatch

13- What’s Code Coverage ?

Code coverage is a metric that helps us to measure the value of
our unit tests.

14- What’s Completion Handler ?

Completion handlers are super convenient when our app is
making an API call, and we need to do something when that
task is done, like updating the UI to show the data from the API
call. We’ll see completion handlers in Apple’s APIs like
dataTaskWithRequest and they can be pretty handy in your own

The completion handler takes a chunk of code with 3

arguments:(NSData?, NSURLResponse?, NSError?) that
returns nothing: Void. It’s a closure.
The completion handlers have to
marked @escaping since they are executed
some point after the enclosing function has
been executed.
15- How to Prioritize Usability in Design ?
Broke down its design process to prioritize usability in 4 steps:

• Think like the user, then design the UX.

• Remember that users are people, not demographics.
• When promoting an app, consider all the situations in which
it could be useful.
• Keep working on the utility of the app even after launch.

16- What’s the difference between the frame and the

The bounds of a UIView is the rectangle, expressed as a location
(x,y) and size (width,height) relative to its own coordinate
system (0,0).
The frame of a UIView is the rectangle, expressed as a location
(x,y) and size (width,height) relative to the superview it is
contained within.

17- What is Responder Chain ?

A ResponderChain is a hierarchy of objects that have the
opportunity to respond to events received.

18- What is Regular expressions ?

Regular expressions are special string patterns that describe
how to search through a string.

19- What is Operator Overloading ?

Operator overloading allows us to change how existing
operators behave with types that both already exist.

20- What is TVMLKit ?

TVMLKit is the glue between TVML, JavaScript, and your
native tvOS application.
21- What is Platform limitations of tvOS ?
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 on-board storage.

tvOS app bundle cannot exceed 4 GB.

22- What is Functions ?

Functions let us group a series of statements together to
perform some task. Once a function is created, it can be reused
over and over in your code. If you find yourself repeating
statements in your code, then a function may be the answer to
avoid that repetition.

Pro Tip, Good functions accept input and return output. Bad
functions set global variables and rely on other functions to

23- What is ABI ?

ABIs are important when it comes to applications that use
external libraries. If a program is built to use a particular library
and that library is later updated, you don’t want to have to re-
compile that application (and from the end-user’s standpoint,
you may not have the source). If the updated library uses the
same ABI, then your program will not need to change. ABI
stability will come with Swift 5.0

24- Why is design pattern very important ?

Design patterns are reusable solutions to common problems in
software design. They’re templates designed to help you write
code that’s easy to understand and reuse. Most common Cocoa
design patterns:
• Creational: Singleton.
• Structural: Decorator, Adapter, Facade.
• Behavioral: Observer, and, Memento

25- What is Singleton Pattern ?

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.

26- What is Facade Design Pattern ?

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.

27- What is Decorator Design Pattern ?

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.

28- What is Adapter Pattern ?

An Adapter allows classes with incompatible interfaces to work
together. It wraps itself around an object and exposes a
standard interface to interact with that object.
29- What is Observer Pattern ?
In the Observer pattern, one object notifies other objects of any
state changes.

Cocoa implements the observer pattern in two

ways: Notifications and Key-Value Observing (KVO).

30- What is Memento Pattern ?

In Memento Pattern saves your stuff somewhere. Later on, this
externalized state can be restored without violating
encapsulation; that is, private data remains private. One of
Apple’s specialized implementations of the Memento pattern is
Archiving other hand iOS uses the Memento pattern as part
of State Restoration.

31- Explain MVC

• Models — responsible for the domain data or a data access

layer which manipulates the data, think of ‘Person’ or
‘PersonDataProvider’ classes.
• Views — responsible for the presentation layer (GUI), for
iOS environment think of everything starting with ‘UI’ prefix.
• Controller/Presenter/ViewModel — the glue or the
mediator between the Model and the View, in general
responsible for altering the Model by reacting to the user’s
actions performed on the View and updating the View with
changes from the Model.

32- Explain MVVM

UIKit independent representation of your View and its state.
The View Model invokes changes in the Model and updates
itself with the updated Model, and since we have a binding
between the View and the View Model, the first is updated
Your view model will actually take in your model, and it can
format the information that’s going to be displayed on your

There is a more known framework called RxSwift. It contains

RxCocoa, which are reactive extensions for Cocoa and

33- How many different annotations available in

Objective-C ?
• _Null_unspecified, which bridges to a Swift implicitly
unwrapped optional. This is the default.
• _Nonnull, the value won’t be nil it bridges to a regular
• _Nullable the value can be nil, it bridges to an optional.
• _Null_resettable the value can never be nil, when read but
you can set it to know to reset it. This is only apply property.

34- What is JSON/PLIST limits ?

• We create your objects and then serialized them to disk..
• It’s great and very limited use cases.
• We can’t obviously use complex queries to filter your results.
• It’s very slow.
• Each time we need something, we need to either serialize or
deserialize it.
• it’s not thread-safe.

35- What is SQLite limits ?

• We need to define the relations between the tables. Define
the schema of all the tables.
• We have to manually write queries to fetch data.
• We need to query results and then map those to models.
• Queries are very fast.

36- What is Realm benefits ?

• An open-source database framework.

• Implemented from scratch.
• Zero copy object store.
• Fast.

37- How many are there APIs for battery-efficient

location tracking ?
There are 3 apis.

• Significant location changes — the location is delivered

approximately every 500 metres (usually up to 1 km)
• Region monitoring — track enter/exit events from circular
regions with a radius equal to 100m or more. Region
monitoring is the most precise API after GPS.
• Visit events — monitor place Visit events which are
enters/exits from a place (home/office).

38- What is the Swift main advantage ?

To mention some of the main advantages of Swift:
• Optional Types, which make applications crash-resistant
• Built-in error handling
• Closures
• Much faster compared to other languages
• Type-safe language
• Supports pattern matching

39- Explain generics in Swift ?

Generics create code that does not get specific about underlying
data types. Don’t catch this article. Generics allow us to know
what type it is going to contain. Generics also provides
optimization for our code.
40- Explain lazy in Swift ?
An initial value of the lazy stored properties is calculated only
when the property is called for the first time. There are
situations when the lazyproperties come very handy to
41- Explain what is defer ?
defer keyword which provides a block of code that will be
executed in the case when execution is leaving the current

42- How to pass a variable as a reference ?

We need to mention that there are two types of variables:
reference and value types. The difference between these two
types is that by passing value type, the variable will create a
copy of its data, and the reference type variable will just point to
the original data in the memory.

43- How to pass data between view controllers?

There are 3 ways to pass data between view controllers.

1. Segue, in prepareForSegue method (Forward)

2. Delegate (Backward)
3. Setting variable directly (Forward)

44- What is Concurrency ?

Concurrency is dividing up the execution paths of your program
so that they are possibly running at the same time. The common
terminology: process, thread, multithreading, and others.

• Process, An instance of an executing app

• Thread, Path of execution for code
• Multithreading, Multiple threads or multiple paths of
execution running at the same time.
• Concurrency, Execute multiple tasks at the same time in a
scalable manner.
• Queues, Queues are lightweight data structures that
manage objects in the order of First-in, First-out (FIFO).
• Synchronous vs Asynchronous tasks

45- Grand Central Dispatch (GCD)

GCD is a library that provides a low-level and object-based API
to run tasks concurrently while managing threads behind the
scenes. Terminology;
• Dispatch Queues, A dispatch queue is responsible for
executing a task in the first-in, first-out order.
• Serial Dispatch Queue A serial dispatch queue runs tasks
one at a time.
• Concurrent Dispatch Queue A concurrent dispatch
queue runs as many tasks as it can without waiting for the
started tasks to finish.
• Main Dispatch Queue A globally available serial queue
that executes tasks on the application’s main thread.

46- Readers-Writers
Multiple threads reading at the same time while there should be
only one thread writing. The solution to the problem is a
readers-writers lock which allows concurrent read-only access
and an exclusive write access. Terminology;
• Race Condition A race condition occurs when two or more
threads can access shared data and they try to change it at
the same time.
• Deadlock A deadlock occurs when two or sometimes more
tasks wait for the other to finish, and neither ever does.
• Readers-Writers problem Multiple threads reading at
the same time while there should be only one thread writing.
• Readers-writer lock Such a lock allows concurrent read-
only access to the shared resource while write operations
require exclusive access.
• Dispatch Barrier Block Dispatch barrier blocks create a
serial-style bottleneck when working with concurrent

47- NSOperation — NSOperationQueue —
NSOperation adds a little extra overhead compared to GCD,
but we can add dependency among various operations and re-
use, cancel or suspend them.

NSOperationQueue, It allows a pool of threads to be created

and used to execute NSOperations in parallel. Operation queues
aren’t part of GCD.

NSBlockOperation allows you to create an NSOperation from

one or more closures. NSBlockOperations can have multiple
blocks, that run concurrently.

48- KVC — KVO
KVC adds stands for Key-Value Coding. It’s a mechanism by
which an object’s properties can be accessed using string’s at
runtime rather than having to statically know the property
names at development time.
KVO stands for Key-Value Observing and allows a controller or
class to observe changes to a property value. In KVO, an object
can ask to be notified of any changes to a specific property,
whenever that property changes value, the observer is
automatically notified.

49- Please explain Swift’s pattern matching techniques

• Tuple patterns are used to match values of corresponding

tuple types.
• Type-casting patterns allow you to cast or match types.
• Wildcard patterns match and ignore any kind and type of
• Optional patterns are used to match optional values.
• Enumeration case patterns match cases of existing
enumeration types.
• Expression patterns allow you to compare a given value
against a given expression.
50- What are benefits of Guard ?
There are two big benefits to guard. One is avoiding the pyramid
of doom, as others have mentioned — lots of annoying if let
statements nested inside each other moving further and further
to the right. The other benefit is provide an early exit out of the
function using break or using return.
1- Please explain Method Swizzling in Swift

Method Swizzling is a well known practice in Objective-C and in other languages that
support dynamic method dispatching.

Through swizzling, the implementation of a method can be replaced with a different one at
runtime, by changing the mapping between a specific #selector(method) and the function that
contains its implementation.

To use method swizzling with your Swift classes there are two requirements that you must
comply with:

• The class containing the methods to be swizzled must extend NSObject

• The methods you want to swizzle must have the dynamic attribute

2- What is the difference Non-Escaping and Escaping Closures ?

The lifecycle of a non-escaping closure is simple:

1. Pass a closure into a function

2. The function runs the closure (or not)
3. The function returns

Escaping closure means, inside the function, you can still run the closure (or not); the extra
bit of the closure is stored some place that will outlive the function. There are several ways to
have a closure escape its containing function:

• Asynchronous execution: If you execute the closure asynchronously on a dispatch

queue, the queue will hold onto the closure for you. You have no idea when the
closure will be executed and there’s no guarantee it will complete before the function
• Storage: Storing the closure to a global variable, property, or any other bit of storage
that lives on past the function call means the closure has also escaped.

for more details.

3- Explain [weak self] and [unowned self] ?

unowned ( non-strong reference ) does the same as weak with one exception: The variable
will not become nil and must not be an optional.

When you try to access the variable after its instance has been deallocated. That means, you
should only use unowned when you are sure, that this variable will never be accessed after
the corresponding instance has been deallocated.

However, if you don’t want the variable to be weak AND you are sure that it can’t be
accessed after the corresponding instance has been deallocated, you can use unowned.

• Every time used with non-optional types

• Every time used with let
By declaring it [weak self] you get to handle the case that it might be nil inside the closure at
some point and therefore the variable must be an optional. A case for using [weak self] in an
asynchronous network request, is in a view controller where that request is used to populate
the view.

4- What is ARC ?

ARC is a compile time feature that is Apple’s version of automated memory management. It
stands for Automatic Reference Counting. This means that it only frees up memory for
objects when there are zero strong references/ to them.

5- Explain #keyPath() ?

Using #keyPath(), a static type check will be performed by virtue of the key-path literal string
being used as a StaticString or StringLiteralConvertible. At this point, it’s then checked to
ensure that it

A) is actually a thing that exists and

B) is properly exposed to Objective-C.

6- What is iOS 11 SDK Features for Developers ?

• New MapKit Markers

• Configurable File Headers
• Block Based UITableView Updates
• MapKit Clustering
• Closure Based KVO
• Vector UIImage Support
• New MapKit Display Type
• Named colors in Asset Catalog
• Password Autofill
• Face landmarks, Barcode and Text Detection
• Multitasking using the new floating Dock, slide-over apps, pinned apps, and the new
App Switcher
• Location Permission: A flashing blue status bar anytime an app is collecting your
location data in the background. Updated locations permissions that always give the
user the ability to choose only to share location while using the app.

for more information.

7- What makes React Native special for iOS?

1. (Unlike PhoneGap) with React Native your application logic is written and runs in
JavaScript, whereas your application UI is fully native; therefore you have none of the
compromises typically associated with HTML5 UI.
2. Additionally (unlike Titanium), React introduces a novel, radical and highly
functional approach to constructing user interfaces. In brief, the application UI is
simply expressed as a function of the current application state.

8- What is NSFetchRequest ?
NSFetchRequest is the class responsible for fetching from Core Data. Fetch requests are both
powerful and flexible. You can use fetch requests to fetch a set of objects meeting the
provided criteria, individual values and more.

9- Explain NSPersistentContainer ?

The persistent container creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate error conditions that
could cause the creation of the store to fail.

10- Explain NSFetchedResultsController ?

NSFetchedResultsController is a controller, but it’s not a view controller. It has no user

interface. Its purpose is to make developers’ lives easier by abstracting away much of the
code needed to synchronize a table view with a data source backed by Core Data.

Set up an NSFetchedResultsController correctly, and your table will mimic its data source
without you have to write more than a few lines of code.

11- What is the three major debugging improvements in Xcode 8 ?

• The View Debugger lets us visualize our layouts and see constraint definitions at
runtime. Although this has been around since Xcode 6, Xcode 8 introduces some
handy new warnings for constraint conflicts and other great convenience features.
• The Thread Sanitizer is an all new runtime tool in Xcode 8 that alerts you to
threading issues — most notably, potential race conditions.
• The Memory Graph Debugger is also brand new to Xcode 8. It provides
visualization of your app’s memory graph at a point in time and flags leaks in the
Issue navigator.

12- What is the Test Driven Development of three simple rules ?

1. You are not allowed to write any production code unless it is to make a failing unit
test pass.
2. You are not allowed to write any more of a unit test than is sufficient to fail; and
compilation failures are failures.
3. You are not allowed to write any more production code than is sufficient to pass the
one failing unit test.

13- Please explain final keyword into the class ?

By adding the keyword final in front of the method name, we prevent the method from being
overridden. If we can replace the final class keyword with a single word static and get the
same behavior.

14- What does Yak Shaving mean ?

Yak shaving is a programing term that refers to a series of tasks that need to be performed
before a project can progress to its next milestone.
15- What is the difference open & public access level ?

open allows other modules to use the class and inherit the class; for members, it allows others
modules to use the member and override it.

public only allows other modules to use the public classes and the public members. Public
classes can no longer be subclassed, nor public members can be overridden.

16- What is the difference fileprivate, private and public private(set) access level ?

fileprivate is accessible within the current file, private is accessible within the current

public private(set) means getter is public, but the setter is private.

17- What is Internal access ?

Internal access enables entities to be used within any source file from their defining module,
but not in any source file outside of the module.

Internal access is the default level of access. So even though we haven’t been writing any
access control specifiers in our code, our code has been at an internal level by default.

18- What is difference between BDD and TDD ?

The main difference between BDD and TDD is the fact that BDD test cases can be read by
non-engineers, which can be very useful in teams.

iOS I prefer Quick BDD framework and its “matcher framework,” called Nimble.

19- Please explain “Arrange-Act-Assert”

AAA is a pattern for arranging and formatting code in Unit Tests. If we were to write
XCTests each of our tests would group these functional sections, separated by blank lines:

• Arrange all necessary preconditions and inputs.

• Act on the object or method under test.
• Assert that the expected results have occurred.

20- What is the benefit writing tests in iOS apps ?

• Writing tests first gives us a clear perspective on the API design, by getting into the
mindset of being a client of the API before it exists.
• Good tests serve as great documentation of expected behavior.
• It gives us confidence to constantly refactor our code because we know that if we
break anything our tests fail.
• If tests are hard to write its usually a sign architecture could be improved. Following
RGR ( Red — Green — Refactor ) helps you make improvements early on.
21- What is five essential practical guidelines to improve your typographic quality of
mobile product designs ?

1. Start by choosing your body text typeface.

2. Try to avoid mixing typefaces.
3. Watch your line length.
4. Balance line height and point size.
5. Use proper Apostrophes and Dashes.

22- Explain Forced Unwrapping

When we defined a variable as optional, then to get the value from this variable, we will
have to unwrap it. This just means putting an exclamation mark at the end of the variable.

23- How to educate app with Context ?

Education in context technique helping users interact with an element or surface in a way
they have not done so previously. This technique often includes slight visual cues and subtle

24- What is bitcode ?

Bitcode refers to to the type of code: “LLVM Bitcode” that is sent to iTunes Connect. This
allows Apple to use certain calculations to re-optimize apps further (e.g: possibly downsize
executable sizes). If Apple needs to alter your executable then they can do this without a new
build being uploaded.

25- Explain Swift Standard Library Protocol ?

There are a few different protocol. Equatable protocol, that governs how we can distinguish
between two instances of the same type. That means we can analyze. If we have a specific
value is in our array. The comparable protocol, to compare two instances of the same type
and sequence protocol: prefix(while:) and drop(while:) [SE-0045].

Swift 4 introduces a new Codable protocol that lets us serialize and deserialize custom data
types without writing any special code.

26- What is the difference SVN and Git ?

SVN relies on a centralised system for version management. It’s a central repository where
working copies are generated and a network connection is required for access.

Git relies on a distributed system for version management. You will have a local repository
on which you can work, with a network connection only required to synchronise.

27- What is the difference CollectionViews & TableViews ?

TableViews display a list of items, in a single column, a vertical fashion, and limited to
vertical or horizontal scrolling only.
CollectionViews also display a list of items, however, they can have multiple columns and

28- What is Alamofire doing ?

Alamofire uses URL Loading System in the background, so it does integrate well with the
Apple-provided mechanisms for all the network development. This means, It provides
chainable request/response methods, JSON parameter and response serialization,
authentication, and many other features. It has thread mechanics and execute requests on a
background thread and call completion blocks on the main thread.

29- REST, HTTP, JSON — What’s that?

HTTP is the application protocol, or set of rules, web sites use to transfer data from the web
server to client. The client (your web browser or app) use to indicate the desired action:

• GET: Used to retrieve data, such as a web page, but doesn’t alter any data on the
• HEAD: Identical to GET but only sends back the headers and none of the actual data.
• POST: Used to send data to the server, commonly used when filling a form and
clicking submit.
• PUT: Used to send data to the specific location provided.
• DELETE: Deletes data from the specific location provided.

REST, or REpresentational State Transfer, is a set of rules for designing consistent, easy-to-
use and maintainable web APIs.

JSON stands for JavaScript Object Notation; it provides a straightforward, human-readable

and portable mechanism for transporting data between two systems. Apple supplies the
JSONSerialization class to help convert your objects in memory to JSON and vice-versa.

30- What problems does delegation solve?

• Avoiding tight coupling of objects

• Modifying behavior and appearance without the need to subclass objects
• Allowing tasks to be handed off to any arbitrary object

31- What is the major purposes of Frameworks?

Frameworks have three major purposes:

• Code encapsulation
• Code modularity
• Code reuse

You can share your framework with your other apps, team members, or the iOS community.
When combined with Swift’s access control, frameworks help define strong, testable
interfaces between code modules.

32- Explain Swift Package Manager

The Swift Package Manager will help to vastly improve the Swift ecosystem, making Swift
much easier to use and deploy on platforms without Xcode such as Linux. The Swift Package
Manager also addresses the problem of dependency hell that can happen when using many
interdependent libraries.

The Swift Package Manager only supports using the master branch. Swift Package Manager
now supports packages with Swift, C, C++ and Objective-C.

33- What is the difference between a delegate and an NSNotification?

Delegates and NSNotifications can be used to accomplish nearly the same functionality.
However, delegates are one-to-one while NSNotifications are one-to-many.

34- Explain SiriKit Limitations

• SiriKit cannot use all app types

• Not a substitute for a full app only an extension
• Siri requires a consistent Internet connection to work
• Siri service needs to communicate Apple Servers.

35- Why do we use a delegate pattern to be notified of the text field’s events?

Because at most only a single object needs to know about the event.

36- How is an inout parameter different from a regular parameter?

A Inout passes by reference while a regular parameter passes by value.

37- Explain View Controller Lifecycle events order ?

There are a few different lifecycle event

- loadView

Creates the view that the controller manages. It’s only called when the view controller is
created and only when done programatically. It is responsible for making the view property
exist in the first place.

- viewDidLoad

Called after the controller’s view is loaded into memory. It’s only called when the view
is created.

- viewWillAppear

It’s called whenever the view is presented on the screen. In this step the view has bounds
defined but the orientation is not applied.

- viewWillLayoutSubviews
Called to notify the view controller that its view is about to layout its subviews. This method
is called every time the frame changes

- viewDidLayoutSubviews

Called to notify the view controller that its view has just laid out its subviews. Make
additional changes here after the view lays out its subviews.

- viewDidAppear

Notifies the view controller that its view was added to a view hierarchy.

- viewWillDisappear

Before the transition to the next view controller happens and the origin view controller gets
removed from screen, this method gets called.

- viewDidDisappear

After a view controller gets removed from the screen, this method gets called. You usually
override this method to stop tasks that are should not run while a view controller is not
on screen.

- viewWillTransition(to:with:)

When the interface orientation changes, UIKit calls this method on the window’s root view
controller before the size changes are about to be made. The root view controller then
notifies its child view controllers, propagating the message throughout the view controller

38- What is the difference between LLVM and Clang?

Clang is the front end of LLVM tool chain ( “clang” C Language Family Frontend for LLVM
). Every Compiler has three parts .
1. Front end ( lexical analysis, parsing )
2. Optimizer ( Optimizing abstract syntax tree )
3. Back end ( machine code generation )

Front end ( Clang ) takes the source code and generates abstract syntax tree ( LLVM IR ).

39- What is Class ?

A class is meant to define an object and how it works. In this way, a class is like a blueprint
of an object.

40- What is Object?

An object is an instance of a class.

41- What is interface?

The @interface in Objective-C has nothing to do with Java interfaces. It simply declares a
public interface of a class, its public API.

42- When and why do we use an object as opposed to a struct?

Structs are value types. Classes(Objects) are reference types.

43- What is UIStackView?

UIStackView provides a way to layout a series of views horizontally or vertically. We can

define how the contained views adjust themselves to the available space. Don’t miss this

44- What are the states of an iOS App?

1. Non-running — The app is not running.

2. Inactive — The app is running in the foreground, but not receiving events. An iOS app
can be placed into an inactive state, for example, when a call or SMS message is
3. Active — The app is running in the foreground, and receiving events.
4. Background — The app is running in the background, and executing code.
5. Suspended — The app is in the background, but no code is being executed.

45- What are the most important application delegate methods a developer should
handle ?

The operating system calls specific methods within the application delegate to facilitate
transitioning to and from various states. The seven most important application delegate
methods a developer should handle are:


Method called when the launch process is initiated. This is the first opportunity to execute
any code within the app.


Method called when the launch process is nearly complete. Since this method is called is
before any of the app’s windows are displayed, it is the last opportunity to prepare the
interface and make any final adjustments.


Once the application has become active, the application delegate will receive a callback
notification message via the method applicationDidBecomeActive.

This method is also called each time the app returns to an active state from a previous switch
to inactive from a resulting phone call or SMS.

There are several conditions that will spawn the applicationWillResignActive method. Each
time a temporary event, such as a phone call, happens this method gets called. It is also
important to note that “quitting” an iOS app does not terminate the processes, but rather
moves the app to the background.


This method is called when an iOS app is running, but no longer in the foreground. In other
words, the user interface is not currently being displayed. According to Apple’s
UIApplicationDelegate Protocol Reference, the app has approximately five seconds to
perform tasks and return. If the method does not return within five seconds, the application is


This method is called as an app is preparing to move from the background to the foreground.
The app, however, is not moved into an active state without the applicationDidBecomeActive
method being called. This method gives a developer the opportunity to re-establish the
settings of the previous running state before the app becomes active.


This method notifies your application delegate when a termination event has been triggered.
Hitting the home button no longer quits the application. Force quitting the iOS app, or
shutting down the device triggers the applicationWillTerminate method. This is the
opportunity to save the application configuration, settings, and user preferences.

46- What is the difference between property and instance variable?

A property is a more abstract concept. An instance variable is literally just a storage slot, like
a slot in a struct. Normally other objects are never supposed to access them directly. Usually
a property will return or set an instance variable, but it could use data from several or none at

47- How can we add UIKit for Swift Package Manager ?

Swift Package Manager is not supporting UIKit. We can create File Template or Framework
for other projects.

48- Explain difference between SDK and Framework ?

SDK is a set of software development tools. This set is used for creation of applications.
Framework is basically a platform which is used for developing software applications. It
provides the necessary foundation on which the programs can be developed for a specific
platform. SDK and Framework complement each other, and SDKs are available for

49- What is Downcasting ?

When we’re casting an object to another type in Objective-C, it’s pretty simple since there’s
only one way to do it. In Swift, though, there are two ways to cast — one that’s safe and one
that’s not .

• as used for upcasting and type casting to bridged type

• as? used for safe casting, return nil if failed
• as! used to force casting, crash if failed. should only be used when we know the
downcast will succeed.

50- Why is everything in a do-catch block?

In Swift, errors are thrown and handled inside of do-catch blocks.

1- What is Nil Coalescing & Ternary Operator ?

It is an easily return an unwrapped optional, or a default value. If we do not have value, we

can set zero or default value.

2- What kind of JSONSerialization have ReadingOptions ?

• mutableContainers Specifies that arrays and dictionaries are created as variables

objects, not constants.
• mutableLeaves Specifies that leaf strings in the JSON object graph are created as
instances of variable String.
• allowFragments Specifies that the parser should allow top-level objects that are not
an instance of Array or Dictionary.

3- Explain subscripts ?

Classes, structures, and enumerations can define subscripts, which are shortcuts for accessing
the member elements of a collection, list, or sequence.

4- What is DispatchGroup ?

DispatchGroup allows for aggregate synchronization of work. We can use them to submit
multiple different work items and track when they all complete, even though they might run
on different queues. This behavior can be helpful when progress can’t be made until all of the
specified tasks are complete. — Apple’s Documentation

The most basic answer: If we need to wait on a couple of asynchronous or synchronous

operations before proceeding, we can use DispatchGroup.

5- What is RGR ( Red — Green — Refactor ) ?

Red, Green and Refactor are stages of the TDD (Test Driven Development).

1. Red: Write a small amount of test code usually no more than seven lines of code and
watch it fail.
2. Green: Write a small amount of production code. Again, usually no more than seven
lines of code and make your test pass.
3. Refactor: Tests are passing, you can make changes without worrying. Clean up your
code. There are great workshop notes here.

6- Where do we use Dependency Injection ?

We use a storyboard or xib in our iOS app, then we created IBOutlets. IBOutlet is a property
related to a view. These are injected into the view controller when it is instantiated, which is
essentially a form of Dependency Injection.

There are forms of dependency injection: constructor injection, property injection and
method injection.

7- Please explain types of notifications.

There are two type of notifications: Remote and Local. Remote notification requires
connection to a server. Local notifications don’t require server connection. Local
notifications happen on device.

8- When is a good time for dependency injection in our projects?

There is a few guidelines that you can follow.

Rule 1. Is Testability important to us? If so, then it is essential to identify external

dependencies within the class that you wish to test. Once dependencies can be injected we
can easily replace real services for mock ones to make it easy to testing easy.

Rules 2. Complex classes have complex dependencies, include application-level logic, or

access external resources such as the disk or the network. Most of the classes in your
application will be complex, including almost any controller object and most model objects.
The easiest way to get started is to pick a complex class in your application and look for
places where you initialize other complex objects within that class.

Rules 3. If an object is creating instances of other objects that are shared dependencies within
other objects then it is a good candidate for a dependency injection.

9- What kind of order functions can we use on collection types ?

• map(_:): Returns an array of results after transforming each element in the sequence
using the provided closure.
• filter(_:): Returns an array of elements that satisfy the provided closure predicate.
• reduce(_:_:): Returns a single value by combining each element in the sequence
using the provided closure.
• sorted(by:): Returns an array of the elements in the sequence sorted based on the
provided closure predicate.

To see all methods available from Sequence, take a look at the Sequence docs.

10- What allows you to combine your commits ?

git squash

11- What is the difference ANY and ANYOBJECT ?

According to Apple’s Swift documentation:

• Any can represent an instance of any type at all, including function types and
optional types.
• AnyObject can represent an instance of any class type.

Check out for more details.

12- Please explain SOAP and REST Basics differences ?

Both of them helps us access Web services. SOAP relies exclusively on XML to provide
messaging services. SOAP is definitely the heavyweight choice for Web service access.
Originally developed by Microsoft.

REST ( Representational State Transfer ) provides a lighter weight alternative. Instead of

using XML to make a request, REST relies on a simple URL in many cases. REST can use
four different HTTP 1.1 verbs (GET, POST, PUT, and DELETE) to perform tasks.

13- What is you favorite Visualize Chart library ?

Charts has support iOS,tvOS,OSX The Apple side of the cross platform MPAndroidChart.

Core Plot is a 2D plotting framework for macOS, iOS, and tvOS

TEAChart has iOS support

A curated list of awesome iOS chart libraries, including Objective-C and Swift

14- What is the difference Filter and Map Function ?

Map, we pass in a function that returns a value for each element in an array. The return value
of this function represents what an element becomes in our new array.

Filter, we pass in a function that returns either true or false for each element. If the function
that we pass returns true for a given element, then the element is included in the final array.

15- What is CoreData ?

Core data is an object graph manager which also has the ability to persist object graphs to the
persistent store on a disk. An object graph is like a map of all the different model objects in a
typical model view controller iOS application. CoreData has also integration with Core

But Core Data is not thread safe, meaning that, if you load a managed object on one thread,
you can’t pass it to another thread and use it safely. This becomes an issue when we want to
start introducing threading for performance, so we have two choices.

The first is to keep everything on the main thread, which just means it’s single threaded. Or
the second, means making changes on background threads and passing managed object IDs
and then loading those objects again on the main thread, but that would mean that you’re on
the main thread, which puts us right back where we started. Both of these kind of ruin the
point of using threading within Core Data and they can add a lot of complexity to the data

There’s also another option for that and it’s to convert the managed object to a plain old Swift
object, or a POSO.

16- Could you explain Associatedtype ?

If you want to create Generic Protocol we can use associatedtype. For more details check this

17- Which git command saves your code without making a commit ?

git stash

18- Explain Priority Inversion and Priority Inheritance.

If high priority thread waits for low priority thread, this is called Priority Inversion. if low
priority thread temporarily inherit the priority of the highest priority thread, this is called
Priority Inheritance.

19- What is Hashable ?

Hashable allows us to use our objects as keys in a dictionary. So we can make our custom

20- When do you use optional chaining vs. if let or guard ?

We use optional chaining when we do not really care if the operation fails; otherwise, we use
if let or guard. Optional chaining lets us run code only if our optional has a value.

Using the question mark operator like this is called optional chaining. Apple’s documentation
explains it like this:

Optional chaining is a process for querying and calling properties, methods, and subscripts
on an optional that might currently be nil. If the optional contains a value, the property,
method, or subscript call succeeds; if the optional is nil, the property, method, or subscript
call returns nil. Multiple queries can be chained together, and the entire chain fails gracefully
if any link in the chain is nil.

21- How many different ways to pass data in Swift ?

There are many different ways such as Delegate, KVO, Segue, and NSNotification, Target-
Action, Callbacks.

22- How do you follow up clean code for this project ?

I follow style guide and coding conventions for Swift projects of Github and SwiftLint.

23- Explain to using Class and Inheritance benefits

• With Overriding provides a mechanism for customization

• Reuse implementation
• Subclassing provides reuse interface
• Modularity
• Subclasses provide dynamic dispatch

24- What’s the difference optional between nil and .None?

There is no difference. Optional.None (.None for short) is the correct way of initializing an
optional variable lacking a value, whereas nil is just syntactic sugar for .None. Check this

25- What is GraphQL ?

GraphQL is trying to solve creating a query interface for the clients at the application level.
Apollo iOS is a strongly-typed, caching GraphQL client for iOS, written in Swift.

26- Explain Common features of Protocols & superclasses

• implementation reuse
• provide points for customization
• interface reuse
• supporting modular design via dynamic dispatch on reused interfaces

27- What is Continuous Integration ?

Continuous Integration allows us to get early feedback when something is going wrong
during application development. There are a lot of continuous integration tools available.

Self hosted server

• Xcode Server
• Jenkins
• TeamCity

Cloud solutions

• TravisCI
• Bitrise
• Buddybuild

28- What is the difference Delegates and Callbacks ?

The difference between delegates and callbacks is that with delegates, the NetworkService is
telling the delegate “There is something changed.” With callbacks, the delegate is observing
the NetworkService.

Check this out.

29- Explain Linked List

Linked List basically consist of the structures we named the Node. These nodes basically
have two things. The first one is the one we want to keep. (we do not have to hold single data,
we can keep as much information as we want), and the other is the address information of the
other node.
Disadvantages of Linked Lists, at the beginning, there is extra space usage. Because the
Linked List have an address information in addition to the existing information. This means
more space usage.

30- Do you know Back End development ?

Depends. I have experienced PARSE and I am awarded FBStart. I decided to learn pure back
end. You have two choices. Either you can learn node.js + express.js and mongodb. OR, you
can learn Vapor or Kitura.

Don’t you like or use Firebase?

Firebase doesn't have a path for macOS X developers.

If you want to learn Firebase, please just follow one month of Firebase Google Group.

31- Explain AutoLayout

AutoLayout provides a flexible and powerful layout system that describes how views and the
UI controls calculates the size and position in the hierarchy.

32- What is the disadvantage to hard-coding log statements ?

First, when you start to log. This starts to accumulate. It may not seem like a lot, but every
minute adds up. By the end of a project, those stray minutes will equal to hours.

Second, Each time we add one to the code base, we take a risk of injecting new bugs into our

33- What is Pointer ?

A pointer is a direct reference to a memory address. Whereas a variable acts as a transparent

container for a value, pointers remove a layer of abstraction and let you see how that value is

34- Explain Core ML Pros and Cons

Pros of Core ML:

• Really easy to add into your app.

• Not just for deep learning: also does logistic regression, decision trees, and other
“classic” machine learning models.
• Comes with a handy converter tool that supports several different training packages
(Keras, Caffe, scikit-learn, and others).


• Core ML only supports a limited number of model types. If you trained a model that
does something Core ML does not support, then you cannot use Core ML.
• The conversion tools currently support only a few training packages. A notable
omission is TensorFlow, arguably the most popular machine learning tool out there.
You can write your own converters, but this isn’t a job for a novice. (The reason
TensorFlow is not supported is that it is a low-level package for making general
computational graphs, while Core ML works at a much higher level of abstraction.)
• No flexibility, little control. The Core ML API is very basic, it only lets you load a
model and run it. There is no way to add custom code to your models.
• iOS 11 and later only.

For more information.

35- What is pair programming?

Pair programming is a tool to share information with junior developers. Junior and senior
developer sitting side-by-side this is the best way for the junior to learn from senior

Check out Martin Fowler on “Pair Programming Misconceptions”, WikiHow on Pair


36- Explain blocks

Blocks are a way of defining a single task or unit of behavior without having to write an
entire Objective-C class. they are anonymous functions.

37- What is Keychain ?

Keychain is an API for persisting data securly in iOS App. There is a good library -

38- What is the biggest changes in UserNotifications ?

• We can add audio, video and images.

• We can create custom interfaces for notifications.
• We can manage notifications with interfaces in the notification center.
• New Notification extensions allow us to manage remote notification payloads before
they’re delivered.

39- Explain the difference between atomic and nonatomic synthesized properties

atomic : It is the default behaviour. If an object is declared as atomic then it becomes thread-
safe. Thread-safe means, at a time only one thread of a particular instance of that class can
have the control over that object.

nonatomic: It is not thread-safe. We can use the nonatomic property attribute to specify that
synthesized accessors simply set or return a value directly, with no guarantees about what
happens if that same value is accessed simultaneously from different threads. For this reason,
it’s faster to access a nonatomic property than an atomic one.

40- Why do we use availability attributes ?

Apple wants to support one system version back, meaning that we should support iOS9 or
iOS8. Availability Attributes lets us to support previous version iOS.

41- How could we get device token ?

There are two steps to get device token. First, we must show the user’s permission screen,
after we can register for remote notifications. If these steps go well, the system will provide
device token. If we uninstall or reinstall the app, the device token would change.

42- What is Encapsulation ?

Encapsulation is an object-oriented design principles and hides the internal states and
functionality of objects. That means objects keep their state information private.

43- What is big-o notation ?

An algorithm is an impression method used to determine the working time for an input N
size. The big-o notation grade is expressed by the highest value. And the big-o notation is
finding the answer with the question of O(n). Here is a cheat sheet and swift algorithm
club. For example;

For Loops big-o notation is O(N). Because For Loops work n times.
Variables (var number:Int = 4) big-o notation is O(1).

44- What Is Dependency Management?

If we want to integrate open source project, add a framework from a third party project, or
even reuse code across our own projects, dependency management helps us to manage these
relationships. Check this out

45- What is UML Class Diagrams?

UML Class Diagram is a set of rules and notations for the specification of a software system,
managed and created by the Object Management Group.

46- Explain throw

We are telling the compiler that it can throw errors by using the throws keyword. Before we
can throw an error, we need to make a list of all the possible errors you want to throw.

47- What is Protocol Extensions?

We can adopt protocols using extensions as well as on the original type declaration. This
allows you to add protocols to types you don’t necessarily own.

48- What is three triggers for a local notification ?

Location, Calendar, and Time Interval. A Location notification fires when the GPS on your
phone is at a location or geographic region. Calendar trigger is based on calendar data broken
into date components. Time Interval is a count of seconds until the timer goes off.
49- Explain Selectors in ObjC

Selectors are Objective-C’s internal representation of a method name.

50- What is Remote Notifications attacment’s limits ?

We can be sent with video or image with push notification. But maximum payload is 4kb. If
we want to sent high quality attachment, we should use Notification Service Extension.
1- What is Functional programming ?

There are three main concepts. These concepts are: separating

functions and data, immutability, and first-class functions.

2- What are the limits of accessibility ?

We can not use Dynamic Text with accessibility features.

3- What is ARC and how is it different from


Autorelease is still used ARC. ARC is used inside the scope,

autorelease is used outside the scope of the function.

4- Explain differences between Foundation and


The Foundation is a gathering of classes for running with

numbers, strings, and collections. It also describes protocols,
functions, data types, and constants. CoreFoundation is a C-
based alternative to Foundation. Foundation essentially is a
CoreFoundation. We have a free bridge with NS counterpart.

5- What’s accessibilityHint?
accessibilityHint describes the results of interacting with a user
interface element. A hint should be supplied only if the result of
an interaction is not obvious from the element’s label.

6- Explain place holder constraint

This tells Interface Builder to go ahead and remove the

constraints when we build and run this code. It allows the layout
engine to figure out a base layout, and then we can modify that
base layout at run time.
7- Are you using CharlesProxy ? Why/why not ?

If I need a proxy server that includes both complete requests

and responses and the HTTP headers then I am
using CharlesProxy. With CharlesProxy, we can support binary
protocols, rewriting and traffic throttling.

8- Explain unwind segue

An unwind segue moves backward through one or more segues

to return the user to a scene managed by an existing view

9- What is the relation between iVar and @property?

iVar is an instance variable. It cannot be accessed unless we

create accessors, which are generated by @property. iVar and its
counterpart @property can be of different names.

iVar is always can be accessed using KVC.

10- Explain UNNotification Content

UNNotification Content stores the notification content in a

scheduled or delivered notification. It is read-only.

11- What’s the difference between Android and iOS


• Android uses icons, iOS mostly uses text as their action

button. When we finish an action, on Android you will see a
checkmark icon, whereas on iOS you’ll have a ‘Done’ or
‘Submit’ text at the top.
• iOS uses subtle gradients, Android uses flat colors and use
different tone/shades to create dimension. iOS uses bright,
vivid colors — almost neon like. Android is colorful, but not
as vivid.
• iOS design is mostly flat, but Android’s design is more
dimensional. Android adds depth to their design with
floating buttons, cards and so on.
• iOS menu is at the bottom, Android at the top. Also a side
menu/hamburger menu is typically Android. iOS usually has
a tab called ‘More’ with a hamburger icon, and that’s usually
the menu & settings rolled into one.
• Android ellipsis icon (…) to show more options is vertical,
iOS is horizontal.
• Android uses Roboto and iOS uses San Francisco font
• Frosted glass effect used to be exclusive to iOS, but you’ll see
a lot of them in Android too nowadays. As far as I know it’s
still a hard effect to replicate in Android.
• Android usually has navigation button in color, whereas iOS
is usually either white or gray.

12- What is Webhooks ?

Webhooks allow external services to be notified when certain

events happen within your repository. (push, pull-request, fork)

13- Explain difference dependency injection and inject


Using dependency injection for a view model or view controller

is easy enough, but to inject dependencies into every view on-
screen would be significant work and a lot more lines of code to

14- Explain CAEmitterLayer and CAEmitterCell

UIKit provides two classes for creating particle
effects: CAEmitterLayer and CAEmitterCell.
The CAEmitterLayer is the layer that emits, animates and
renders the particle system. The CAEmitterCell represents the
source of particles and defines the direction and properties of
the emitted particles.

15- Why do we need to specify self to refer to a stored

property or a method When writing asynchronous

Since the code is dispatched to a background thread we need to

capture a reference to the correct object.

16- Explain NSManagedObjectContext

Its primary responsibility is to manage a collection of managed


17- Explain service extension

The service extension lets us the chance to change content in the

notification before it is presented.

18- Explain content extension

The content extension gives us the tools, we have in an app to

design the notification.

19- What is intrinsic content size?

Every view that contains content can calculate its intrinsic

content size. The intrinsic content size is calculated by a method
on every UIView instance. This method returns a CGSize
20- What is Instruments?

Instrument is a powerful performance tuning tool to analyze

that performance, memory footprint, smooth animation, energy
usage, leaks and file/network activity.

21- What is Deep Linking?

Deep linking is a way to pass data to your application from any

platform like, website or any other application. By tapping once
on link, you can pass necessary data to your application.

22- What is Optional Binding ?

We are going to take optional value and we are going to bind it

non optional constant. We used If let structure or Guard

23- Explain super keyword in child class

We use the super keyword to call the parent class initializer after
setting the child class stored property.

24- Explain Polymorphism

Polymorphism is the ability of a class instance to be substituted

by a class instance of one of its subclasses.

25- Explain In-app Purchase products and

• Consumable products: can be purchased more than once
and used items would have to re-purchase.
• Non-consumable products: user would be able to restore
this functionality in the future, should they need to reinstall
the app for any reason. We can also add subscriptions to our
• Non-Renewing Subscription: Used for a certain amount
of time and certain content.
• Auto-Renewing Subscription: Used for recurring
monthly subscriptions.

26- What is HealthKit ?

HealthKit is a framework on iOS. It stores health and fitness

data in a central location. It takes in data from multiple sources,
which could be different devices. It allows users to control
access to their data and maintains privacy of user data. Data is
synced between your phone and your watch.

27- What is Protocol?

A protocol defines a blueprint of methods, properties and other

requirements that suit a particular task or piece of functionality.
The protocol can then be adopted by a class, structure, or
enumeration to provide an actual implementation of those
The Swift Programming Language Guide
by Apple

28- Explain Neural networks with Core ML

Neural networks and deep learning currently provide the best

solutions to many problems in image recognition, speech
recognition, and natural language processing.

Core ML is an iOS framework comes with iOS 11, helps to

process models in your apps for face detection. For more
information follow this
guideline https://developer.apple.com/machine-learning/
29- Explain libssl_iOS and libcrypto_iOS

These files are going to help us with on device verification of our

receipt verification files with In-App purchases.

30- Explain JSONEncoder and JSONDecoder in Swift4

Decodable protocol, which allows us to take data and create

instances of our object, populated with the data passed down
from the server.

Encodable protocol to take instances of our object and turn it

into data. With that data, we can store it to the files, send it to
the server, whatever you need to do with it.

31- What is CocoaTouch ?

CocoaTouch is a library used to build executable applications on

iOS. CocoaTouch is an abstract layer on the iOS.

32- What is NotificationCenter ?

NotificationCenter is an observer pattern,

The NSNotificationCenter singleton allows us to broadcast
information using an object called NSNotification.
The biggest difference between KVO and NotificationCenter is
that KVOtracks specific changes to an object,
while NotificationCenter is used to track generic events.

33- Why is inheritance bad in swift?

• We cannot use superclasses or inheritance with Swift value
• Upfront modelling
• Customization for inheritance is an imprecise
For more information check this out

34- Explain Sequence in Swift

Sequence is a basic type in Swift for defining an aggregation of

elements that distribute sequentially in a row. All collection
types inherit from Sequence such as Array, Set, Dictionary.

35- What is Receipt Validation ?

The receipt for an application or in-app purchase is a record of

the sale of the application and of any in-app purchases made
from within the application. You can add receipt validation code
to your application to prevent unauthorized copies of your
application from running.

36- Explain generic function zip(_:_:)

According to the swift documentation, zip creates a sequence of

pairs built out of two underlying. That means, we can create a
dictionary includes two arrays.

37- What kind of benefits does Xcode server have for


Xcode server will automatically check out our project, build the
app, run tests, and archive the app for distribution.

38- What is Xcode Bot?

Xcode Server uses bots to automatically build your projects. A

bot represents a single remote repository, project, and scheme.
We can also control the build configuration the bot uses and
choose which devices and simulators the bot will use.

39- Explain .gitignore

.gitignore is a file extension that you tell Git server about
document types, and folders that you do not want to add to the
project or do not want to track changes made in Git server

40- What is Strategy Pattern?

Strategy pattern allows you to change the behaviour of an

algorithm at run time. Using interfaces, we are able to define a
family of algorithms, encapsulate each one, and make them
interchangeable, allowing us to select which algorithm to
execute at run time. For more information check this out.

41- What is an “app ID” and a “bundle ID” ?

A bundle ID is the identifier of a single app. For example, if your

organization’s domain is xxx.com and you create an app named
Facebook, you could assign the string com.xxx.facebook as our
app’s bundle ID.

An App ID is a two-part string used to identify one or more apps

from a single development team. You need Apple Developer
account for an App ID.

42- What is Factory method pattern?

Factory method pattern makes the codebase more flexible to

add or remove new types. To add a new type, we just need a new
class for the type and a new factory to produce it like the
following code. For more information check this out.

43- What is CoreSpotlight?

CoreSpotlight allows us to index any content inside of our app.

While NSUserActivity is useful for saving the user’s history, with
this API, you can index any data you like. It provides access to
the CoreSpotlight index on the user’s device.

44- What are layer objects?

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.

45- Explain AVFoundation framework

We can create, play audio and visual media. AVFoundation

allows us to work on a detailed level with time-based audio-
visual data. With it, we can create, edit, analyze, and re-encode
media files. AVFoundation has two sets of API, one that’s video,
and one that is audio.

46- What’s the difference between accessibilityLabel

and accessibilityIdentifier?
accessibilityLabel is the value that’s read by VoiceOver to the end-
user. As such, this should be a localized string. The text should
also be capitalized. Because this helps with VoiceOver’s
pronunciation. accessibilityLabel is used for testing and Visual
Impaired users.
accessibilityIdentifier identifies an element via accessibility, but
unlike accessibilityLabel, accessibilityIdentifier's purpose is purely
to be used as an identifier for UI Automation tests. We use a
value for testing process.

47- How to find the distance between two points (1x, 1y

and 2x, 2y)?

We need to calculate the distance between the points, we can

omit the sqrt() which will make it a little faster. This question’s
background is Pythagorean theorem. We can find the result
with CGPoint.
| \
| \ H
| \
| \
|_ _ _\

48- Explain Property Observer

A property observer observes and responds to changes in a

property’s value. With property observer, we don’t need to reset
the controls, every time attributes change.

49- What’s the difference between a xib and a


Both are used in Xcode to layout screens (view controllers). A

xib defines a single View or View Controller screen, while a
storyboard shows many view controllers and also shows the
relationship between them.

50- Explain how to add frameworks in Xcode project?

• First, choose the project file from the project navigator on
the left side of the project window
• Then choose the target where you want to add frameworks in
the project settings editor
• Choose the “Build Phases” tab, and select “Link Binary With
Libraries” to view all of the frameworks
• To add frameworks click on “+” sign below the list select
framework and click on add button.
1- Explain Data Structures

Arrays, Sets, Tuples, and Dictionaries are all collections of data

structures that store data in one place.

2- Explain CodingKey Protocol

The CodingKeys enum ( Protocol ) lets you rename specific
properties in case the serialized format doesn’t match the
requirements of the API. CodingKeys should have nested enum.

3- Explain IGListKit

IGListKit provides automatically diff objects to create

insertions, deletions, and moves before performing batch
updates on the collection view. If a user deletes an update in the
queue we’re viewing, we’ll see it fade out without requiring a
pull down to refresh.

We say goodbye to UICollectionViewDatasource, and instead

use an IGListAdapter with a IGListAdapterDataSource. The
data source doesn’t return counts or cells, instead it provides an
array of Section Controllers. Section Controllers are then used
to configure & control cells within the given collection view

4- What is URLSession?

When we want to retrieve contents from certain URL,we choose

to use URLConnection. There are three types of tasks:
Data tasks: getting data to memory
Download tasks: downloading file to disk
Upload tasks: uploading file from disk and
receiving response as data in memory
5- How do we download images?

With URLSession, we can download an image as a data then

convert it from NSData to UIImage lastly we connect it
UIImageView IBOutlet. Better way is to use a library. Also with
URLSession Adaptable Connectivity API we can built-in
connectivity monitoring and run a request, if there is no
connection. Request will wait and download whenever the
resource is available instead of failing.

6- How does TestFlight make a difference?

• Multiple builds distribution
• Testing groups
• Internal auto distribution
• Tester metrics
• Increased to 10,000 test users
• Public Link

7- What is SnapKit or Masonry make a difference from

Auto layout?

SnapKit or Masonry help us to do Auto Layout on both iOS and

OS X with code, and I use two libraries with that.

8- Explain IteratorProtocol
The IteratorProtocol protocol is tightly linked with
the Sequence protocol. Sequences provide access to their elements
by creating an iterator, which keeps track of its iteration process
and returns one element at a time as it advances through the
sequence. There are very good examples on the differences
ofIteratorProtocol from for loop and while loop.
9- Explain differences between WKWebView and

WKWebView has own cookie storage and its not share by the
whole app and all other web views like in the case of

10- Explain XLIFF Pros and Cons

• It helps us to extract the localization work from or code so
we don’t have to make any language assumptions in your
source code.
• XLIFF files also holds the content to be localized from our
development language along with the translations.
• XLIFF consolidates strings from different resources and
different file types into one single document.


• XLIFF does not give them that visual and functional context.
• XLIFF does not provide the resource data like assets in your
• XLIFF does not provide with the custom metadata about the
generated XLIFF.

11- What is difference Layout Margins and Directional

Layout Margins ?
• Layout Margins property of a UIView is of type
UIEdgeInsets and defines the top, left, bottom and right
insets that when applied to the view’s frame define the view’s
• Directional Layout Margins that are aware of Right-To-
Left (RTL) languages. This follows the pattern used when
creating constraints with layout anchors. See this earlier post
about RTL Languages.

12- What is Sequence protocol ?

A sequence is a list of values that we can step through one at a
time. The most common way to iterate over the elements of a
sequence is to use a for-inloop

13- What is OAuth ?

OAuth short for Open Authorization, is an authorization
protocol and not one used for authentication. OAuth being an
authorization protocol, isn’t concerned with identifying the
user. Instead it deals with the authorization of a third party
application to access user data without exposing the user’s
credentials. There are two libraries: OAuthSwift & OAuth2

14- What is offset ?

If we want to arrange the button at Bottom-Right of superview

with spacing 20 Pts, we use view attribute of UIButton or
UILabel for reference to view attribute of superview and
use .offset(x) for set padding.

15- Explain rethrows keyword

rethrows is a pretty special keyword that you can use in

conjunction with closures that can throw errors.

The rethrows keyword indicates to the compiler that the outer

function is a throwing function only if the closure passed in
throws an error that is propagated to the current scope.
Basically with rethrows, we can use throw
inside the closure. When the error handlers
are called within the function we use throws.

16- Explain @objc inference

We can tag a Swift declaration with @objc to indicate that it

should be available to Objective-C. In Swift 3 many declarations
were automatically inferred to be made available to Objective-C.
The most common place for this is any Swift method we want to
refer to using a selector.

17- What is Safe area ?

Safe area allows us to create constraints to keep our content
from being hidden by UIKit bars like the status, navigation or
tab bar. Previously we used topLayoutGuide and bottomLayoutGuide.

18- Explain Viper Architecture

Viper is an another design patters. It has five layers: View,

Interactor, Presenter, Entity, and Router. It is based
on Single Responsibility Principle.

Advantages of Viper architecture is communication from one

entity to another is given through protocols. The idea is to
isolate our app’s dependencies, balancing the delegation of
responsibilities among the entities.

You can find more details in this article.

19- Explain Content offset

When we scroll a scrollView, it modifies a property known as

content offset. Content offset is a point at which the origin of the
contentView, that is the bounds rectangle, is offset from the
origin of the scrollView.

Using this value, the scrollView can compute its new bounds
and redraw any of its subviews.

20- Explain Queues

Queues are used to store a set of data, but are different in that
the first item to go into this collection, will be the first item to be
removed. Also well known as FIFO which means, ‘first in first

21- Explain @objcMembers inference

When we declare this class as having @objcMembers everything

in the class will be exposed to the Objective-C runtime. This is
the same as writing implicitly @objc in front of the function.

22- What’s new with Xcode Server ?

There are a few improvements:

• Xcode Server no longer need macOS Server app, it’s now

built inside Xcode 9.
• Continuous integration bots can be run on any Mac with
Xcode 9, no need to install macOS Server.

23- Explain type inference

Swift uses type inference to work out the appropriate type. Type
inference enables a compiler to deduce the type of a particular
expression automatically when it compiles your code, simply
by examining the values you provide.

24- What is the difference between Array vs NSArray ?

Array can only hold one type of data, NSArray can hold different
types of data. The array is value type, NSArray is immutable
reference type.

25- What is NSLayoutAnchor ?

With iOS 9, Apple introduced the NSLayoutAnchor class to make
writing autolayout easier with code.
There are three subclasses of NSLayoutAnchor:
• NSLayoutXAxisAnchor This subclass is used to create horizontal
• NSLayoutYAxisAnchor This subclass is used to create vertical
• NSLayoutDimensionThis subclass is used to create the width
and height constraints
26- What is themutating keyword ?
The mutating keyword is used to let variables be modified in
a struct or enum.

27- What is snapshot testing ?

Snapshot testing is a way to automatically test the aesthetic part

of your UI. It consists of creating a view from your app and
comparing it against a reference image.

28- What is circular dependencies ?

A circular dependency is a relation between two or more

modules which either directly or indirectly depend on each
other to function properly. Such modules are also known as
mutually recursive.

29- What’s the difference between MKAnnotation and

MKAnnotation is a protocol. Typically, we will create a NSObject
subclass that implements this protocol. Instances of this custom
class will then serve as your map annotation.
is a class that implements MKAnnotation. We
can use it directly if we want our own business logic on the

30- What is DTO ?

DTO is widely used in web projects. It declares the response to
the Mappableprotocol. It contains the implementation of
the mapping(map: Map) function.

31- Explain Main Thread Checker

The Main Thread Checker is a new tool launched with Xcode 9

which detects the invalid use of Apple’s frameworks like UIKit,
AppKit etc that supposed to be used from main thread but
accidentally used in the background thread. The effect of the
invalid usage can result in missed UI updates, visual defects,
data corruption, and crashes. You can read more about the
Main Thread Checker here.

32- What is the difference Stack and Heap ?

Our code takes up some space in the iOS. The size of this is
sometimes fixed and sometimes it can change according to what
the user will enter during the program. Basically we have two
different methods because of this difference: Stack and Heap

Stack is used and automatically removes itself from memory

after work is finished. But in Heap the user could do it by
writing manual code for deleting from memory.

• Stack is easy to use.
• It’s kept in RAM on the computer.
• Created variables are automatically deleted when they exit
the stack.
• It is quite fast compared to Heap.
• Constructed variables can be used without a pointer.


• Compared to Stack, it is quite slow.

• It creates memory problems if not used correctly.
• Variables are used with pointers.
• It is created at runtime.

33- Explain VIP ( Clean-Swift) Architecture

ViewController interacts directly with an Interactor by

sending Requests to it. The Interactor responds to those
requests by sending a Response with data model to
a Presenter. The Presenter formats data to be displayed,
creates a ViewModel and notifies the ViewController that it
should update its View based on
the ViewModel. ViewController decides when the
navigation to a different scene should happen by calling a
method on a Router. The Router performs setup of the next
View Controller and deals with wiring, passing data and
delegation setup.

When compared to VIPER, difference is that

the ViewController itself contacts Router for navigation.

Please check out this project.

34- Explain UIBezierPath

class allows us define custom paths that describe any
shape, and use those paths to achieve any custom result we

35- Explain Dependency Injection Container

The container keeps a map of each class type to an instance of

that class. We can then instantiate any class by simply providing
the type to the container. The container
then automatically provides dependencies for the class.

36- Explain ObjectMapper for parsing JSON data

ObjectMapper converts JSON data to strongly typed model

objects. It has a two-way binding between JSON and deal with
generic object and nested objects. Also we can manage

37- Explain CAShapeLayer

CAShapeLayer is a CALayer subclass, its provides hardware-
accelerated drawing of all sorts of 2D shapes, and includes extra
functionality such as fill and stroke colors, line caps, patterns
and more. Check out for more details.

38- Explain Get Request Steps

We’re going to create the task. We’re going to receive the data
back from the server. And we’re going to handle it based on if
there’s any errors and what the data is.

39- Explain coordinate systems in views

UIkit defines a default coordinate system with the origin in the

top left corner, and axis extending to the right, and down from
the origin point. Views are laid out within this coordinate
system to position and size them.
In addition to this Default Coordinate System, which we’ll call
the Screen Coordinate System, an app’s window and views also
define their own Local Coordinate System.

For example single view, a view object tracks its size and
location using a frame and bounds. A frame is a rectangle,
which specifies the size and location of the view within its
SuperView coordinate system.

A bounds rectangle, on the other hand, specifies the size of the

view within its own local coordinate system. Please remember
part 1.

40- Explain Encoding, Decoding and Serialization,

Serialization is the process of converting data into a single
string or json so it can be stored or transmitted
easily. Serialization, also known as encoding. The reverse
process of turning a single string into a data is called decoding,
or deserialization. In swift we useCodable protocol that a type
can conform to, to declare that it can be encoded and decoded.
It’s basically an alias for the Encodable and Decodable protocols.

41- What is the purpose of using IBAction and

IBOutlet ?
IBAction and IBOutlet are macros defined to denote variables and
methods that can be referred to in Interface Builder.
IBAction resolves to void and IBOutlet resolves to nothing, but they
signify to Xcode and Interface builder that these variables and
methods can be used in Interface builder to link UI elements to
your code.

42- Explain AlamoFire Benefits

• AlamoFire creates a route. This means we can create the

request and execute it to the server by one static function.
• AlamoFire provides method chaining for the requests that’s
returned, which makes it easy for adding headers,and
handling responses.
• AlamoFire has multiple response handlers hat’s returned in
binary form, text, parse JSON, and we can even use multiple
of these for a given request.
• AlamoFire has the method chaining allows for response
validation. We can call validation to check for the status code
of the HTTP response, the content type, or any custom
validation you might need to do for our app.
• AlamoFire gives us that use a couple of protocols,
URLConvertible, and URLRequestConvertible. These
protocols can be passed in when creating a request.
• AlamoFire provides extensions can be passed in to create the

43- Explain Semaphore in iOS

When we do thread operations on iOS, it works. The application

is quite effective in preventing data from interfering with
different processes while downloading data to the device. Or we
can time out the process by checking the wait time.
As a structure, more than one working process is kept waiting
according to the situation and the other process are engaged in
the processes such as entering the circuit when completed.

44- What is LLDB?

It’s the debugger of The LLVM Compiler Infrastructure. Here is

the homepageand this is a good article about it: Dancing in
the Debugger — A Waltz with LLDB.

45- Explain Tuples

Tuples are a compound type in Swift, that means we can hold

multiple values like a structure. Tuples hold very value types of
data but we created data structures (like dictionaries).

46- Explain the difference between Generics and

AnyObject in Swift

Generics are type safe, meaning if you pass a string as a generic

and try to use as a integer the compiler will complain and you
will not be able to compile your. Because Swift is using Static
typing, and is able to give you a compiler error.

If you use AnyObject, the compiler has no idea if the object can
be treated as a String or as an Integer. It will allow you to do
whatever you want with it.

47- Explain Dependency Inversion Principle

Dependency Inversion Principle serves to decouple classes from

one another by explicitly providing dependencies for them,
rather than having them create the dependencies themselves.

48- What is Smoke Testing?

Smoke Testing, also known as “Build Verification Testing”, is a
type of software testing that comprises of a non-exhaustive set
of tests that aim at ensuring that the most important functions

The term ‘smoke testing’, it is said, came to software testing

from a similar type of hardware testing, in which the device
passed the test if it did not catch fire (or smoked) the first time
it was turned on.

49- Explain how does UIEdgeInsetsMake work?

According to the documentation: We can use this method to add
cap insets to an image or to change the existing cap insets of an
image. In both cases, you get back a new image and the original
image remains untouched. We use the amount of pixels what we
want to make unstretchable in the values of
the UIEdgeInsetsMake function. Goal is to keep original rounded
corners of image. With UIEdgeInsets, we can specify how many
pixels to the top, left, bottom, and right stretching the image.
Syntax : UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0)

50- What is the meaning of id ?

id is a pointer to any type, it always points to an Objective-C
object. The AnyObject protocol is similar and it helps bridge the
gap between Swift and Objective-C.
1. IOS Characteristics
Criteria Result

Type of Operating System Apple Proprietary based on Macintosh OS X

OS Fragmentation Tightly integrated with Apple devices

Security Heightened security guaranteed

2. What JSON framework is supported by iOS (iPhone OS)?

• SBJson framework is supported by iOS. It is a JSON parser and generator

for Objective-C (Objective-C is the primary programming language you use
when writing software for OS X and iOS. It’s a superset of the C
programming language and provides object-oriented capabilities and a
dynamic runtime).
• SBJson provides flexible APIs and additional control that makes JSON
handling easy.

3. How can we prevent iOS 8 app's streaming video media from being captured
by QuickTime Player on Yosemite during screen recording?
HTTP Live Streams that have their media encrypted will not be recorded by
QuickTime Player on Yosemite while screen recording. These will black out in the
• HTTP Live Streaming: – Send live and on‐demand audio and video to iPhone,
iPad, Mac, Apple TV, and PC with HTTP Live Streaming (HLS) technology from
Apple. Using the same protocol that powers the web, HLS lets you deploy content
using ordinary web servers and content delivery networks. HLS is designed for
reliability and dynamically adapts to network conditions by optimizing playback for
the available speed of wired and wireless connections.
4. Name the framework that is used to construct application’s user interface
for iOS

• The UIKit framework is used to develop 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 user input, and
-> 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
✓ A view controller model to encapsulate the contents of your 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
✓ 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
Check this tutorial, to learn more about iOS user interface.
5. How can you respond to state transitions on your app?
State transitions can be responded to state changes in an appropriate way by calling
corresponding methods on app’s delegate object.
For example:
applicationDidBecomeActive( ) method can be used to prepare to run as the
foreground app.
applicationDidEnterBackground( ) method can be used to execute some code when
the app is running in the background and may be suspended at any time.
applicationWillEnterForeground( ) method can be used to execute some code when
your app is moving out of the background
applicationWillTerminate( ) method is called when your app is being terminated.
6. What are the features added in iOS 9?

• Intelligent Search and Siri- Intelligent Search 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 is a personal assistant to the users, able to create contextual reminders
and search through photos and videos in new ways. Swiping right from the
home screen also brings up a new screen that houses “Siri Suggestions,”
putting favorite contacts and apps right on your fingertips, along with nearby
restaurant and location information and important news.
• Deeper search capabilities can show results like sports scores, videos, and
content from third-party apps, and you can even do simple conversions and
calculations using the search tools on your iPhone or iPad.Performance
• Many of the built-in apps have been improved.
✓ Notes includes new checklists and sketching features
✓ Maps now offers transit directions
✓ Mail allows for file attachments, and
✓ New “News” app that learns your interests and delivers relevant content
you might like to read.
✓ Apple Pay is being improved with the addition of store credit cards and
loyalty cards
✓ Leading “Passbook” to be renamed to “Wallet” in iOS 9.
• San Francisco font, wireless CarPlay support
• An optional iCloud Drive app, built-in two-factor authentication and optional
longer passwords for better security.

7. What is the difference between retain & assign?

Assign creates a reference from one object to another without increasing the
source’s retain count.

if (_variable != object)

[_variable release];

_variable = nil;

_variable = object;

Retain creates a reference from one object to another and increases the retain count
of the source object.

if (_variable != object)

[_variable release];

_variable = nil;

_variable = [object retain];

8. What are the different ways to specify layout of elements in UIView?

Here are a few common ways to specify the layout of elements in UIView:
• Using InterfaceBuilder, you can add an XIB file to your project, layout elements
within it, and then load the XIB in your application code (either automatically, based
on naming conventions, or manually). Also, using InterfaceBuilder you can create a
storyboard for your application.
• You can write your own code to use NSLayoutConstraints and have elements in a
view arranged by Auto Layout.
• You can create CGRects describing the exact coordinates for each element and
pass them to UIView’s – (id)initWithFrame:(CGRect)frame method.
Click here, to learn more about the layout of elements in UIView.
9. What is the difference between atomic and non-atomic properties? Which is
the default for synthesized properties? When would you use one over the

• Properties specified as atomic are guaranteed to always return a fully

initialized object. This also happens to be the default state for synthesized
• While it’s a good practice to specify atomic to remove the potential for
confusion, if you leave it off, your properties will still be atomic.
• This guarantee of atomic properties comes at the cost of performance.
• However, if you have a property for which you know that retrieving an
uninitialized value is not a risk (e.g. if all access to the property is already
synchronized via other means), setting it to non-atomic can boost

Learn iOS from Experts! Enrol Today

10. Describe managed object context and it's function.

• A managed object context (represented by an instance of

NSManagedObjectContext) is a temporary “scratchpad” in an application for
a (presumably) related collection of objects. These objects collectively
represent an internally consistent view of one or more persistent stores.
• A single managed object instance exists in one and only one context, but
multiple copies of an object can exist in different contexts.

The key functions of managed object context include

• Life-cycle management: Here, the context provides validation, inverse

relationship handling and undo/redo
• Notifications refer to context posts notifications at various points that can
be optionally monitored elsewhere in your application.
• Concurrency is when the Core Data uses thread (or serialized queue)
confinement to protect managed objects and managed object contexts.

Learn more about iOS from this tutorial.

11. Explain Singleton class.
Only one instance of that class is created in the application.

@interface SomeManager : NSObject

+ (id)singleton;


@implementation SomeManager

+ (id)singleton {

static id sharedMyManager = nil;

@synchronized([MyObject class]){

if (sharedMyManager ==
nil) {

aredMyManager = [[self alloc] init];

return sharedMyManager;


//using block

+ (id) singleton {

static SomeManager *sharedMyManager = nil;

static dispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

sharedMyManager = [[self alloc] init];


return sharedMyManager;

12. What is unnamed category

Unnamed Category has fallen out of favor now that @protocol has been extended to
support @optional methods.
A class extension –
@interface Foo() — is designed to allow you to declare additional private API —
SPI or System Programming Interface — 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 readonly @property as
readwrite prior to @synthesize’ing the accessors.


@interface Foo:NSObject

@property(readonly, copy) NSString *bar;

-(void) publicSaucing;



@interface Foo()

@property(readwrite, copy) NSString *bar;

- (void) superSecretInternalSaucing;


@implementation Foo

@synthesize bar;

.... must implement the two methods or compiler will warn ....


13. Does Objective-C contain private methods?

NO, there is nothing called a private method in Object-C programming. If a method is
defined in .m only then it becomes protected. If in .h,it is public.
If you really want a private method then you need to add a local category/ unnamed
category/ class extension in the class and add the method in the category and define
it in the class.m.
Click here, to learn more about Objective-C.
14. What is plist?
Plist refers to Property lists that organize data into named values and lists of values
using several object types. These types provide you 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 you to convert hierarchically structured combinations of these
basic types of objects to and from standard XML. You can save the XML data to disk
and later use it to reconstruct the original objects.
The user defaults system, which you 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 like as
NSColor and NSFont objects, from the user default system. But if objects conform to
the NSCoding protocol they can be archived to NSData objects, which are property
list–compatible objects.
Click here, to learn about iOS online training course.
15. What is the purpose of reuseIdentifier? What is the benefit of setting it to a
non-nil value?

• The reuseIdentifier is used to group together similar rows in a UITableView;

i.e., rows that differ only in their content, but otherwise have similar layouts.
• A UITableView will normally allocate just enough UITableViewCell objects to
display the content visible in the table.
• If reuseIdentifier is set to a non-nil value then UITableView will first attempt
to reuse an already allocated UITableViewCell with the same reuseIdentifier
when the table view is scrolled.
• If reuseIdentifier has not been set, the UITableView will be forced to allocate
new UITableViewCell objects for each new item that scrolls into view,
potentially leading to laggy animations.

16. What is the difference between an “app ID” and a “bundle ID” and what is
each used for?

• An App ID is a two-part string to identify one or more apps from a single

development team. The string consists of a Team ID and a bundle ID search
string, with a period (.) separating the two parts.
• The Team ID is supplied by Apple and is unique to a specific development
team while a bundle ID search string is supplied by the developer to match
either the bundle ID of a single app or a set of bundle IDs for a group of
Since most users consider the App ID as a string, they think it is
interchangeable with Bundle ID. Once the App ID is created in the Member
Center, you can only use the App ID Prefix that matches the Bundle ID of the
Application Bundle.
The bundle ID uniquely defines each App. It is specified in Xcode. A single
Xcode project can have multiple targets and therefore, output multiple apps.
A common use case for this – An app having both lite/free and pro/full
versions or branded multiple ways.
17. What is Abstract class in Cocoa?
Cocoa doesn’t provide anything called abstract. We can create a class abstract that
gets checked only at runtime while it is not checked at compile time.

@interface AbstractClass : NSObject


@implementation AbstractClass

+ (id)alloc{

if (self == [AbstractClass class]) {

NSLog(@"Abstract Class can’t be used");

return [super alloc];


18. What is NSURLConnection class? Define its types and use case.
There are two ways of using NSURLConnection class. One is asynchronous and the
other is synchronous.
An asynchronous connection will create a new thread and performs its download
process on the new thread. A synchronous connection will block the calling thread
while downloading content and doing its communication.
Many developers think that a synchronous connection blocks the main thread, which
is not true. A synchronous connection will always block the thread from which it is
fired. If you fire a synchronous connection from the main thread, the main thread will
be blocked. But, if you fire a synchronous connection from a thread other than the
main thread, it will be like an asynchronous connection and won’t block your main
In fact, the only difference between a synchronous and an asynchronous
connection is that at runtime, a thread will be created for the asynchronous
connection while it won’t do the same for a synchronous connection.
In order to create an asynchronous connection, we need to do the following:
1. Have our URL in an instance of NSString
2. Convert our string to an instance of NSURL
3. Place our URL in an URL Request of type NSURLRequest, or in the case of
mutable URLs, in an instance of NSMutableURLRequest.
4. Create an instance of NSURLConnection and pass the URL request to it.
Learn more about iOS, in this iOS online training course.
19. What is the relation between iVar and @property?
iVar is an instance variable. It cannot be accessed unless we create accessors,
which are generated by @property. iVar and its counterpart @property can be of
different names.

@interface Box : NSObject{

NSString *boxName;

@property (strong) NSString *boxDescription;//this will become another ivar


@implementation Box

@synthesize boxDescription=boxName;//now boxDescription is accessor for nam


-(void)aMethod {

NSLog(@"name=%@", boxName);


NSLog(@"boxDescription=%@",boxDescription); //throw an error

• Q

Name four important data types found in Objective-C.

Four data types that you’ll definitely want your developer to be aware of are as

o NSString: Represents a string.

o CGfloat: Represents a floating point value.

o NSInteger: Represents an integer.

o BOOL: Represents a boolean.


• Q

How proficient are you in Objective-C and Swift? Can you briefly describe
their differences?

When Swift was first launched in 2014, it was aptly described as “Objective-C
without the C.” By dropping the legacy conventions that come with a language built
on C, Swift is faster, safer, easier to read, easier to maintain, and designed
specifically for the modern world of consumer-facing apps. One of the most
immediately visible differences is the fact that Objective-C lacks formal support for
namespaces, which forces Objective-C code to use two- or three-letter prefixes to
differentiate itself. Instead of simple names like “String,” “Dictionary,” and “Array,”
Objective-C must use oddities like “NSString,” “NSDictionary,” and “NSArray.”

Another major advantage is that Swift avoids exposing pointers and other “unsafe”
accessors when referring to object instances. That said, Objective-C has been around
since 1983, and there is a mountain of Objective-C code and resources available to
the iOS developer. The best iOS developers tend to be pretty well versed in both,
with an understanding that Swift is the future of iOS development.


• Q

What are UI elements and some common ways you can add them to your

Buttons, text fields, images, labels, and any other elements that are visible within the
application are called UI elements. These elements may be interactive and comprise
the user interface (hence the term “UI”) of an application. In iOS development, UI
elements can be quickly added through Xcode’s interface builder, or coded from
scratch and laid out using NSLayoutConstraints and Auto Layout. Alternatively, each
element can also be positioned at exact coordinates using the UIView
“(id)initWithFrame:(CGRect)frame” method.


• Q

Explain the purpose of the reuseIdentifier in the UITableViewCell


(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NS
String *)reuseIdentifier

The reuseIdentifier tells UITableView which cells may be reused within the table,
effectively grouping together rows in a UITableView that differ only in content but
have similar layouts. This improves scroll performance by alleviating the need to
create new views while scrolling. Instead the cell is reused whenever
dequeueReusableCellWithIdentifier: is called.


• Q
What are some common execution states in iOS?

The common execution states are as follows:

o Not Running: The app is completely switched off, no code is being executed.

o Inactive: The app is running in the foreground without receiving any events.

o Active: The app is running in the foreground and receiving events.

o Background: The app is executing code in the background.

o Suspended: The app is in the background but is not executing any code.


• Q

What is the purpose of managed object context

(NSManagedObjectContext) in Objective-C and how does it work?

Managed object context exists for three reasons: life-cycle management,
notifications, and concurrency. It allows the developer to fetch an object from a
persistent store and make the necessary modifications before deciding whether to
discard or commit these changes back to the persistent store. The managed object
context tracks these changes and allows the developer to undo and redo changes.


• Q

Determine the value of “x” in the Swift code below. Explain your answer.

var a1 = [1, 2, 3, 4, 5]
var a2 = a1
var x = a1.count

In Swift, arrays are implemented as structs, making them value types rather than
reference types (i.e., classes). When a value type is assigned to a variable as an
argument to a function or method, a copy is created and assigned or passed. As a
result, the value of “x” or the count of array “a1” remains equal to 5 while the count
of array “a2” is equal to 6, appending the integer “6” onto a copy of the array “a1.”
The arrays appear in the box below.

a1 = [1, 2, 3, 4, 5]

a2 = [1, 2, 3, 4, 5, 6]


• Q

Find the bug in the Objective-C code below. Explain your answer.

@interface HelloWorldController : UIViewController

@property (strong, nonatomic) UILabel *alert;


@implementation HelloWorldController

- (void)viewDidLoad {
CGRect frame = CGRectMake(150, 150, 150, 50);
self.alert = [[UILabel alloc] initWithFrame:frame];
self.alert.text = @"Hello...";
[self.view addSubview:self.alert];
, 0),
self.alert.text = @"World";


All UI updates must be performed in the main thread. The global dispatch queue
does not guarantee that the alert text will be displayed on the UI. As a best practice,
it is necessary to specify any updates to the UI occur on the main thread, as in the
fixed code below:


dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)



dispatch_async(dispatch_get_main_queue(), ^{

self.alert.text = @"World";




• Q

Explain the difference between raw and associated values in Swift.

This question tests the developer’s understanding of enumeration in Swift.
Enumeration provides a type-safe method of working with a group of related values.
Raw values are compile time-set values directly assigned to every case within an
enumeration, as in the example detailed below:

enum Alphabet: Int {

case A = 1

case B

case C

In the above example code, case “A” was explicitly assigned a raw value integer of 1,
while cases “B” and “C” were implicitly assigned raw value integers of 2 and 3,
respectively. Associated values allow you to store values of other types alongside
case values, as demonstrated below:

enum Alphabet: Int {

case A(Int)

case B

case C(String)


• Q

You’ve just been alerted that your new app is prone to crashing. What do
you do?

This classic interview question is designed to see how well your prospective
programmer can solve problems. What you’re looking for is a general methodology
for isolating a bug, and their ability to troubleshoot issues like sudden crashes or
freezing. In general, when something goes wrong within an app, a standard
approach might look something like this:

o Determine the iOS version and make or model of the device.

o Gather enough information to reproduce the issue.

o Acquire device logs, if possible.

o Once you have an idea as to the nature of the issue, acquire tooling or create
a unit test and begin debugging.
A great answer would include all of the above, with specific examples of debugging
tools like Buglife or ViewMonitor, and a firm grasp of software debugging theory—
knowledge on what to do with compile time errors, run-time errors, and logical
errors. The one answer you don’t want to hear is the haphazard approach—visually
scanning through hundreds of lines of code until the error is found. When it comes
to debugging software, a methodical approach is must.