iOS developers are in-demand professionals because of their ability to work on the frontend of iOS devices. iOS developers with industry knowledge and appropriate technical skills can earn to a greater extent and it’s a very diversified field.
The demand for the iOS developers is growing day by day. A large number of companies are hiring for this commendable position.
Let’s learn about the common interview questions for iOS developers to help you ace your interview.
1. What are the characteristics of iOS?
a) Apple based Macintosh OS X
b) Integrated with Apple Devices
c) High-end security guaranteed
2. What are the different iOS Application states?
Not Running – Initially the app is in not running state that means the app has not been launched yet.
Inactive – When the application is running in background state, not receiving any events. App can stay here while in transition to a different state, hence we cannot interact with the app’s UI as well.
Active – When it is in main execution state, running in foreground and receiving events. This is a normal mode where users can interact with the UI.
Background – This is the state when the user minimizes the app and jumps to the home screen or starts another app.
Suspended – Not in executing state. When the iOS decides it is running out of space, it suspends the app. Example : Battery Low, Power off, Force quit, etc.
3. Which framework is used to construct an application’s UI for iOS?
UI Kit – It is an imperative framework. It basically constructs and manages a graphical, event-driven UI for your iOS application.
4. What is immutability? What are its benefits?
Immutability is something which does not change over time. In the case of Swift, “let” is used.
- Code is simpler and safe
- No risk of accidental mutation
- Thread-safe
- Less coupling
-
What is the difference between POP and OOP?
POP | OOP |
It focuses on implementation of a protocol. | It is based on the concept of an object. |
Uses protocol extensions to add functionality to types that conform to our protocols | It allows encapsulation of the properties and actions of objects to single type. |
Uses a combination of protocols and protocol extensions to implement polymorphism | Implements polymorphism using class hierarchies |
6. What is the difference between Any and Any Object?
Any | Any Object |
It can represent any type of class, struct, enum including function and optional types or you can say anything at all. | It refers to any instance of a class. It’s useful when you are working with a reference type only. It is equivalent to ‘id’ in Objective-C. |
Any is for both value and reference types. | Any Object is for reference types only. |
7. What is the UI button hierarchy?
UIButton -> UIControl -> UIView -> UIResponder -> NSObject
8. What is App Delegate?
App Delegate is the main entry of the application. App Delegate methods are called application life-cycle events.
9. What are application life cycle events in App Delegate File?
a) didFinishLaunchingWithOptions
b) viewDidLoad
c) applicationDidBecomeActive
Example:
To stop the app, go to Home Screen – appWillResignActive -> appDidEnterBackground
To resume the app – appWillEnterForeground -> appDidBecomeActive
For lock screen – appWillResignActive -> appDidEnterBackground
To resume or unlock the screen – appWillEnterForeground -> appDidBecomeActive
To terminate – appWillResignActive -> appDidEnterBackground -> Terminate
10. What is NSError?
It is a cocoa class. Knowledge about an error condition is encapsulated in an extendable object-oriented manner by NSErrorObject.
11. What are three different ways to specify layout of elements in UIView?
a) Interface Builder (XIB)
b) Write code to use NSLayout constraints
c) Create CGRects
12. What are the differences between AppId and BundleId?
App Id | Bundle Id |
It is a two part string that is used to identify one or more apps from a single development team. | It refers to any instance of a class. It’s useful when you are working with a reference type only. It is equivalent to ‘id’ in Objective-C. |
[Team ID.Bundle ID] | [Bundle ID] |
Example : ABCD27.com.saumya.testapp | Example : com.saumya.testapp |
13. What do you mean by ‘defer’ keyword?
It provides a block of code executed in cases when execution leaves current scope. It is for running cleanup actions before the current scope exits, according to Apple.
Example:
Output : 3 2 1
fun printValues() {
defer { print(1) }
defer { print(2) }
print(3)
}
14. How would you define Dictionary in Swift?
Dictionary is an unordered collection of values. They are the key-value pairs.
Example :
var testData = [String : Int] ——————> var testData = [“test1” : 21 , “test2” ; 25]
15. What are tuples and what are their types?
They are value types. It is a temporary container for multiple values, that means it basically groups multiple values into a single compound value.
Example:
let amp = (“Saumya”, 4536, “Delhi”)
Types of Tuples:
a) Closed Range – 1…5 ——————> 1 2 3 4 5
b) Half Range – 1..<5 ——————> 1 2 3 4
c) One Side – 2… ——————> 234 or …2 ——————> 0 1 2
16. What is DRM ?
DRM (Digital Rights Management) is a set of tools and techniques to create access control generally around proprietary hardware or copyright materials online.
The easy way to play DRM-protected videos on iOS devices is to use the AVFoundation framework.
Example : FAIRPLAY framework is the DRM implementation that works over HTTP Live Streaming protocol.
FAIRPLAY is Apple’s DRM specification. It has been used by Apple for its iTunes media service.
17. Also known as NSAutoReleasePoolIt is a storage of objects that get sent release commands when the pool is drained.
We have seen how using auto release pool in Swift would be helpful. However, thanks to ARC, we don’t need to use it too often anymore. Previously, use of auto release pool was very frequent in Objective-C.
18. What are Enums?
It is a data type that has a fixed set of related values. It simply tracks the state of an application. Enums can bundle individual values and multiple states to provide a comprehensive picture of exactly what is going on at any given moment while the application is running.
Example :
enum FontConstants {
case robotoBlack
case robotoBold
case robotoxmedium
case robotoRegular
case robotoBlack
}
Now, you can use FontConstants “enum” directly in your code.
Example: UI Font – FontConstants.robotoBold
19. What is NSURL ?
Object representing a location of a resource that bridges to the URL. It is composed of two parts:
a) A base URL
b) A string that is resolved relative to base URL
20. Which should be used to load data from a server to display the view?
If the data is static, load it in viewDidLoad and then cache it.
If the data is dynamic, use viewDidAppear.
viewDidLoad – It is loaded into memory.
viewDidAppear – It is called when the view is visible and presented on the device.
We hope you got the idea of what some of the iOS developer interview questions could be in your next interview. If you are looking for challenging opportunities at some of the fastest-growing global companies, join Talent500. Sign up here.