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 nil instance in Objective-C? Is the behavior same in Swift?

  • Write a method which will imitate the recursiveDescription method in lldb

  • Write a method to find closest ancestor of two given subViews

  • Suppose you call the contains method on Swift array - What is the worst time complexity of this method?

  • What is difference between NSArray vs NSSet?

  • What is difference between isKindOfClass and isMemberOfClass instance 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 GCD and NSOperationQueue

  • Why knowledge of GCD is 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 GCD and NSThread

  • 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 class vs struct in 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 IBOutlets be 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 used NSAttributedStrings? What is the use case for them?

  • What are the view tags on iOS? Should you or should you not use them?

  • Should IBOutlets be weak or strong?

  • Should delegates be 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 UIView instance

  • 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.x to Swift 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, delegate and blocks/closures

  • How does iOS handle missing frame or unwanted memory usage while using UITableView and UICollectionView?

  • What is the benefit of cell reusability in UITableView and UICollectionView?

  • Difference between copy and retain

  • What does @synchronized keyword do on iOS?

  • What does @synthesized keyword 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 KVO on 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, Storyboards or programatic layout. What do you prefer.

  • Write a code which will given the constraints will constrain a square UIView in such as way that irrespective of orientation, it will maintain the square shape and maintain a padding of 10px in 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 enumerated do in Swift?

  • Do you need to remove object from list of observers for previously added NSNotification on iOS 10? If so, why? If not which circumstances to do need to remove it explicitly?

  • When does the deinit method 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 coalescing operator 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 lazy property in Swift. Can it cause memory leak if self is used while computing lazy property?

  • How does Swift performs error handling?

  • Difference between try, try! and try?

  • How can you make UITableViewto have dynamic cell height based on the content?

  • Please explain autoreleasepool in 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 defer keyword? 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)load get called on the class?

  • When does method +(void)initialize get called on the class?

  • Architect a game of chess in either Objective-C or Swift

  • Write your own cancellable_dispatch_after method 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 UIViewController instance to setup custom views and layouts?

  • You just noticed that app is crashing in the production with crash log provided by Crashlytics or relevant crash logging service. What are your next steps to find the root cause of issues?

  • Given the Selector of method, what iOS mechanism would you use to execute that method with multiple arguments? (Say 2 or more)

  • Difference between Swift map and flatMap

  • What is guard in Swift. Which scenarios would you use it instead of simple if let check?

  • What happens when you try to dequeue cell with a cell identifier which was never registered with a given UITableView instance?

  • 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, nonnull etc.)

  • 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 map function in Swift

  • Explain the difference between escaping and non-escaping closure

  • Explain the keyword @autoclosure in Swift

  • Explain parameter passed via inout keyword vs regular method

  • What will be the value of result in 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 of ViewController for 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? and as!

  • 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

iOS interview questions and answers

Interview Questions

Natasha the Robot

iOS Interview questions