Swift language questions
"What is the difference between class and struct in Swift?" Structs are value types (copied on assignment), classes are reference types (shared by reference). Value types are safer for concurrency. Classes support inheritance and deinit. Apple recommends structs as the default; use classes for identity-based objects or Objective-C interoperability.
"Explain Swift's optional system and how to safely unwrap." Optionals represent a value that may be absent. Forced unwrapping (value!) crashes if nil: avoid in production. Safe approaches: optional binding (if let x = optional), guard statements, nil coalescing (optional ?? default), and optional chaining (optional?.property).
Memory management questions
"What is ARC and what are retain cycles?" ARC deallocates objects when their reference count reaches zero. A retain cycle occurs when two objects hold strong references to each other, preventing deallocation. Common example: a closure captures self strongly and self holds the closure. Fix with [weak self] in the capture list. Use weak when the reference might become nil; unowned only when you can guarantee it outlives the closure.
"How do you diagnose a memory leak in an iOS app?" Use Xcode Instruments: the Leaks instrument shows retained objects no longer reachable, the Allocations instrument shows memory growth. Common causes: retain cycles in closures or delegate patterns (use weak delegates), timers holding strong references, cached images never released.
UIKit and SwiftUI questions
"Explain the UIViewController lifecycle." In order: viewDidLoad (view hierarchy created, set up subviews here), viewWillAppear (refresh data), viewDidAppear (view on screen, start heavy operations), viewWillDisappear, viewDidDisappear. Fetch data once in viewDidLoad; refresh on viewWillAppear if data changes when the user navigates back.
"SwiftUI vs UIKit: when to choose each?" SwiftUI is declarative and the recommended choice for new apps targeting iOS 15+. UIKit gives more control for complex custom animations and UIKit-only APIs. Many production apps use both: SwiftUI for screens, UIKit for specific components.
How to prepare
Know Swift Concurrency (async/await, actors, TaskGroup): it has replaced most completion handler patterns. Know the App Store experience (provisioning profiles, TestFlight, App Review) as it comes up in every senior interview. Review Apple WWDC sessions from the past two years for currently recommended APIs. Build and publish something — interviewers at Apple platform roles ask about real decisions you made in real apps.