Top iOS Interview Questions and How to Answer Them

Let’s face it. A lot of iOS developers are terrified when it comes to interviewing including me. So, I am just putting the questions that are being asked the most and the answer I believe you should give in this blog post to help everyone out.

Q: What is the difference between frames and bounds?

Bounds refers to the views own coordinate system while Frame refers to the views parent coordinate system.

Further Explanation: When to use frame and when to use bounds

Since frame relates a view’s location in its parent view, you use it when you are making outward changes, like changing its width or finding the distance between the view and the top of its parent view.

Use the bounds when you are making inward changes, like drawing things or arranging subviews within the view. Also use the bounds to get the size of the view if you have done some transformation on it.

Q: What is the difference between class and struct?

Classes are reference types and structs are value types.

Further Explanation:

  • Classes can inherit from another class, like you inherit from UIViewController to create your own view controller subclass
  • Classes can be deinitialized, i.e. you can invoke a deinit() function before the class is destroyed
  • Class object is not thread-safe while struct object is thread safe as a copy of class object will copy the reference, reusing the same reference while a copy of struct object will copy the value, creating a new copy that doesn’t affect the object that is being copied.

Tricky Question: Are swift classes inside struct passed by copy during assignment?

Q: What is ARC (Automatic Reference Counting)?

Automatic Reference Counting (ARC) is a memory management attribute used to monitor and manage an application’s memory usage. Swift memory management works automatically without control. It automatically allocates or de-allocates memory to allow efficient running of applications.

Q: What is the difference between strong, weak, read-only, and copy?

Strong : Through the life of the object, the reference count will be increased and the reference will be maintained

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

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

Copy : It means that when an object is created, we’re copying its value. Also prevents its value from changing.

Q: What is a closure?

Closures are self-contained functions that can be used in different places in the code.

Closures can capture and store references to any constants and variables from the context in which they’re defined.

Tricky Question:

var number = 3

let closure = { [number] in
    print("number: \(number)")

number = 5

closure() // Interviewer will ask you what the result is? The answer is "number: 3"

Q: What is escaping and non-escaping closure?

  • An escaping closure is a closure that’s called after the function it was passed to returns. In other words, it outlives the function it was passed to.
  • non-escaping closure is a closure that’s called within the function it was passed into, i.e. before it returns. This closure never passes the bounds of the function it was passed into.
  • In Swift, a closure is non-escaping by default. If a closure can escape the function, you’ll need to annotate its function parameter with the @escaping keyword. 

Q: What is a retain cycle and explains how it happen?

A retain cycle (also known as a reference cycle) is when two objects hold a strong reference to one another. An example of this is: Object A is holding a strong reference to Object B , and Object B is also holding a strong reference to Object A.

Q: What is a software design pattern? Can you share some of the patterns that you have used before?

This is an open-ended questions but you should be familiar with at least some common design patterns, such as MVC, MVVM, VIPER, and able to explain the reason why we should use each of them and its drawbacks. Some of the considerations are:

  • Testability. Ask: “Is it easy to write unit test or UI test on?”
  • Learnability: Ask “If a new member joins the team and have never used this pattern before, how soon they can learn and start to contribute?”
  • Complexity: Ask “Does the reward worth the effort to adopt this pattern?”. For example, while VIPER maybe suitable for large project with 50++ developers, it may not be suitable for small to medium sized project (less than 10 developers) as it requires the developer to create many files and have well designed requirements.

Q: What is [new feature] introduced by Apple in the latest WWDC?

You can substitute any new feature into the blank above. This question is normally used to check whether you are constantly learning the latest practice or feature released by Apple in WWDC. The common questions now are Swift Concurrency, Async & Await, and MainActor.


Above are some common questions that normally get asked in an iOS developer’s interview. This list is not finite, so feel free to explore and research more from other sources in the Internet. Another tip I recommend to every developer is to keep the list of questions asked during your interview, so that you can use them as your references when you need to prepare for your next job or interview a new candidate for your company. Personally, I keep my list in Trello, you can use any tool to do it as well.

Thanks for reading until here! Share it to your friends if you think this article is helpful for you.

Leave a Comment

Your email address will not be published. Required fields are marked *