List of Interview Questions for iOS Developers
Over the years of iOS development has taught me some interesting facts about Objective-C and Swift. Some of them I learned from my own experience and most of them either from senior colleagues or other online resources (Attributions added to the end). Based on this knowledge I have compiled a list of interview questions one can use to prepare while applying for the job of iOS developer.
Although I have not divided them into level of seniority, most of them point to the level of senior developer. This list is by no means to be the exhaustive. A smart interviewer can always come up with original questions. This list is something you can use to test yourself on the latest and greatest knowledge of iOS development.
-
How did you begin iOS development?
-
What is your most/least favorite iOS feature?
-
Which is the most recent iOS version you developed for?
-
Give me hierarchy of UIView/UIButton classes
-
What is the root object for Swift/Objective-C classes?
-
What happens when you send message to
nilinstance in Objective-C? Is the behavior same in Swift? -
Write a method which will imitate the
recursiveDescriptionmethod inlldb -
Write a method to find closest ancestor of two given subViews
-
Suppose you call the
containsmethod on Swift array - What is the worst time complexity of this method? -
What is difference between
NSArrayvsNSSet? -
What is difference between
isKindOfClassandisMemberOfClassinstance methods in Objective-C? -
Enlist the ways to fight memory leaks
-
Objective-C memory management - please explain.
-
Why retain count should never be used in the context of memory management?
-
Could retain count of object ever reach to zero? Yes or no and why so?
-
Explain the difference between
GCDandNSOperationQueue -
Why knowledge of
GCDis important? -
Please explain the concept behind UI thread and background thread.
-
What are the implications of running heavy operations on main thread? What can developer gain by offloading them to background thread?
-
Please explain the difference between
GCDandNSThread -
What does the dynamic keyword does in Objective-C and Swift?
-
Is there a data structure we can use in iOS which can guarantee both order and uniqueness of stored objects?
-
Explain primitive vs non-primitive types
-
Please give the example of primitive and non-primitive types in Swift.
-
Explain
classvsstructin Swift. Which one is better and why? Give me use cases where one is better than other -
Do you watch any videos or subscribe to newsletters to get latest and greatest news on Swift development
-
Explain the concept of optional type in Swift
-
Explain the difference between implicit vs force unwrapping
-
Should
IBOutletsbe optional or implicitly unwrapped? Why? -
Explain the retain cycles and ways to tackle them
-
Difference between
[weak self]and[unowned self] -
How do you animate
NSLayoutConstraints?
Have you usedNSAttributedStrings? What is the use case for them? -
What are the view tags on iOS? Should you or should you not use them?
-
Should
IBOutletsbe weak or strong? -
Should
delegatesbe weak or strong? -
Have you ever used Xcode view or memory debugger? What did you use it for?
-
Which libraries or native support do you use to handle networking and local caching?
-
What are
NSUserDefaults? when to use them over Core data? -
Explain how push notification works on iOS. Have you ever setup push service through Apple certificates and keys by yourself? How was your experience with it?
-
Write a method to print all the subviews of the input
UIViewinstance -
Do you have any experience with architecting iOS app? Please explain
-
Have you ever undertook a task to convert reasonably large project from
Swift 2.xtoSwift 3.x? Please explain your experience. What difficulties did you face and lessons learnt in the process. -
Please explain how you are a great team player.
-
Have you used
Autolayout? Please briefly explain its working. What are the disadvantages, if any? -
Do you work on any side projects?
-
What is the mechanism for objects communication on iOS?
-
Difference between
NSNotificationCenter,delegateandblocks/closures -
How does iOS handle missing frame or unwanted memory usage while using
UITableViewandUICollectionView? -
What is the benefit of cell reusability in
UITableViewandUICollectionView? -
Difference between
copyandretain -
What does
@synchronizedkeyword do on iOS? -
What does
@synthesizedkeyword do on iOS? -
Can you write a method to make a singleton in Objective-C and Swift?
-
What are the benefits / disadvantages of singletons?
-
Can you add property to Objective-C categories? If so, how?
-
Considerations for downloading a data from server and displaying it on
tableView -
How would you design and architect a screen where user can type search result and app will show relevant suggestions fetched from the server?
-
What is key-value coding?
-
Can you use
KVOon primitive or local objects which are not declared as properties? -
What is the concept of
NSZombies? How can you turn that on? What are the benefits of using it in the development? -
Xibs,Storyboardsor programatic layout. What do you prefer. -
Write a code which will given the constraints will constrain a square
UIViewin such as way that irrespective of orientation, it will maintain the square shape and maintain a padding of10pxin direction of smallest dimension. (e.g. Smallest dimension for portrait is width and for landscape height) -
What is MVC? Have yo ever used MVVM? If so, please explain the data binding framework you're used with it and your opinion about it.
-
Please explain any of your side projects written on iOS platform.
-
What does
enumerateddo in Swift? -
Do you need to remove object from list of observers for previously added
NSNotificationon iOS 10? If so, why? If not which circumstances to do need to remove it explicitly? -
When does the
deinitmethod in Swift is called? Are there any circumstances when it won't be called? -
What tool do you use to debug network requests for iOS apps?
-
What is
nil coalescingoperator in Swift? -
Does Objective-C support function/operator overloading? Does Swift support it?
-
What is toll free bridging?
-
What is the best approach for mocking objects in Swift during unit testing?
-
Please explain the recursive enums in Swift.
-
Please explain the access control modifiers in Swift? What are the types and brief description of each.
-
Please explain the
lazyproperty in Swift. Can it cause memory leak ifselfis used while computinglazyproperty? -
How does Swift performs error handling?
-
Difference between
try,try!andtry? -
How can you make
UITableViewto have dynamic cell height based on the content? -
Please explain
autoreleasepoolin terms of iOS memory management -
Please explain the steps when message is sent to an object instance? What happens when receiver is not able to handle the sent message?
-
What is the purpose of
deferkeyword? Say if you have 3 defers lined up in your method. What is their order of execution? -
What will following code do upon execution?
- (void)setAddress:(NSString*)address {
self.address = address;
}
-
Explain the properties in Objective-C
-
Have you ever worked with UI tests on iOS platform? Did you use 3rd party library or native framework? What is your preference?
-
When does method
+(void)loadget called on the class? -
When does method
+(void)initializeget called on the class? -
Architect a game of chess in either Objective-C or Swift
-
Write your own
cancellable_dispatch_aftermethod which can be cancelled before it gets after specified time interval -
Explain deep vs shallow copy? Give the collection of recursive array with objects (e.g.
[100, [2, 3], [3, 4, 5], [3, [3, 5], 8], 10]) write a routine which will create a deep copy of this collection -
Difference between category and inheritance. What are the advantages of using category over inheritance?
-
What is class clusters?
-
What is
dispatch_once? Use case for using it. Is it synchronous / asynchronous, thread safe, or not? -
Do you perform code reviews? What are the benefits or what things did you learn from code reviews?
-
What is the best place in
UIViewControllerinstance to setup custom views and layouts? -
You just noticed that app is crashing in the production with crash log provided by
Crashlyticsor relevant crash logging service. What are your next steps to find the root cause of issues? -
Given the
Selectorof method, what iOS mechanism would you use to execute that method with multiple arguments? (Say 2 or more) -
Difference between Swift
mapandflatMap -
What is
guardin Swift. Which scenarios would you use it instead of simpleif letcheck? -
What happens when you try to dequeue cell with a cell identifier which was never registered with a given
UITableViewinstance? -
Say your project is cluttered with Singletons where multiple class use them. How would you refactor the project keeping the singleton as it is, but making the project easier to test?
-
Explain the difference between synchronous and asynchronous task?
-
Explain the available annotations in Objective-C (
nullable,nonnulletc.) -
Have you used Realm? How do you find it different from Core data? Which option would you prefer for production grade applications?
-
Write your own
mapfunction in Swift -
Explain the difference between
escapingandnon-escapingclosure -
Explain the keyword
@autoclosurein Swift -
Explain parameter passed via
inoutkeyword vs regular method -
What will be the value of
resultin the following code?
func doThis(_ s: inout String) -> Int {
var s1 = s
s1 = "xyz"
return s
}
let s1 = "abc"
let result = doThis(&s1)
-
Suppose you have a large project with many
ViewControllers. Now you have this new requirement which says you need to add tracking to every screen which will track the name ofViewControllerfor every screen when that view appears. How would you do it with minimal efforts and maximum efficiency? -
How can you know if application has been terminated or went into background?
-
Please explain the difference between
is,as,as?andas! -
If I have an instance variable which I want to observe for value changes. Can I use KVO to achieve this goal?
-
Why is it necessary to remove notification observers when object is deallocated?
I will keep adding questions as they come to my mind. In the meantime, if there are other questions you want me to add to the list please let me know. I will make an addition with appropriate attribution
References:
iOS Interview Tips Questions Answers
Swift interview questions and answers

