iOS interview questions reported at Meta

16 questions candidates reported being asked at Meta. Anonymous and unverified, so treat it as a hint of what to expect.

They cover Swift language, Memory, ARC & runtime, UIKit, Layout, rendering & animation, System design & staff+, Coding rounds. Every question below links to a full answer with the common traps and the follow-ups an interviewer is likely to ask, so you can practise the way the interview goes: answer first, then defend it.

  1. What is the difference between struct, class, and actor? 1.1.2
  2. What is an Optional in Swift, and what is it internally? 1.2.1
  3. Escaping vs non-escaping closures? 1.5.1
  4. How does ARC work, and how is it different from garbage collection? 3.1.1
  5. Given two UIViews, find their closest common superview. How do you handle a view that is its own ancestor, or views in different trees? 7.13.1
  6. Write a function that checks whether one CGRect fully contains another, then explain how you decide whether a touch lies inside a view that sits inside a scrolled parent. 9.12.1
  7. How does the client learn about new data: polling, long polling, WebSocket, server-sent events or push? How do you choose? 26.8.2
  8. Design the client of a flight booking app: search, seat hold, payment and confirmation. How do you handle a timed hold, double taps and a payment that fails? 26.8.3
  9. Two-sum: given an array and a target, return the indices of two elements that add up to it. How do you get from O(n²) to O(n), and which edge cases do you test? 29.1.1
  10. Merge overlapping intervals: [[1,3],[8,10],[2,6],[15,18]] becomes [[1,6],[8,10],[15,18]]. How do you do it, and when do touching intervals count as overlapping? 29.1.2
  11. Write an Array extension that removes every element that appears in a second array. What is the complexity, and what if the elements are only Equatable? 29.1.3
  12. Add two non-negative numbers given as decimal strings, without converting them to integers. Why can you not just use Int, and how does the carry loop work? 29.1.4
  13. Given a string with brackets, remove the fewest parentheses to make it valid. How do you count them, and how do you build the fixed string? 29.1.5
  14. Next permutation: rearrange an array into the next lexicographically greater order, in place. Walk through the algorithm. 29.1.7
  15. Reverse a singly linked list in Swift, iteratively and recursively. What can go wrong with long lists? 29.2.1
  16. Implement a hash map from scratch (get, set, remove), then extend it: what do you test and how does resizing work? 29.2.2