Swift Interview Questions 2026
Swift interviews at Apple, mobile-first startups, and FAANG mobile teams test optionals, protocol-oriented design, and the ARC memory model.
Optionals and Unwrapping
Optionals represent values that may be absent. Safe unwrapping: if let, guard let, optional chaining (obj?.property). Forced unwrapping (!) crashes on nil. Use guard let over if let when the rest of the function requires the value.
nil coalescing (??) provides a default. map and flatMap on optionals transform the wrapped value without unwrapping. Pattern matching on optionals in switch is idiomatic Swift.
Protocol-Oriented Programming
Swift protocols can define default implementations via extensions, enabling composition over inheritance. A type can conform to multiple protocols. Protocol extensions can add computed properties and methods.
Protocols with associated types (associatedtype) are powerful but complex. They cannot be used as existential types directly (before Swift 5.7, you needed some Protocol or any Protocol). Know the difference between opaque types (some) and existential types (any).
Value vs Reference Semantics
Structs and enums are value types: copied on assignment. Classes are reference types: shared on assignment. Swift standard library favors structs for performance and safety (Array, Dictionary, String are all structs with copy-on-write optimization).
When to use class: when you need reference semantics (shared mutable state), when you need inheritance, or when interfacing with Objective-C APIs. When to use struct: default choice, especially for data models that do not need shared mutation.
ARC and Memory Management
ARC (Automatic Reference Counting) tracks strong references and deallocates when the count reaches zero. Retain cycles occur when two objects hold strong references to each other. Break cycles with weak or unowned.
weak: optional reference that becomes nil when the referent is deallocated. unowned: non-optional reference that crashes if accessed after deallocation. Use weak when the referenced object may outlive the referencer; unowned when lifetimes are tied.
Browse iOS and Mobile Questions
Real iOS and mobile engineering questions from top companies.
Browse All Companies