Q/A library

iOS interview questions

Search by title or keywords, narrow by topic, difficulty, or tag, then open a question for a full write-up with code to practice your answer.

How would you demonstrate Copy-on-Write behavior with a custom struct?

Demonstrate Copy-on-Write with a value-typed linked list that shares storage on assignment and copies it only when a mutation occurs using isKnownUniquelyReferenced.

What's the difference between strong, weak, and unowned references?

Under ARC, strong keeps an object alive, unowned tracks a direct non-owning pointer that must outlive use, and weak goes through a side table so access can become nil after deinit

Which design patterns have you used in iOS, and what tradeoffs did they have?

Group design patterns into creational, structural, and behavioral, then explain real iOS examples from SDKs and your own implementation experience with the tradeoffs that matter in production

How does struct memory layout work in Swift?

Explain MemoryLayout, padding, alignment, and stride; show why stored-property order changes a struct's footprint; and connect it to arrays, performance, and low-level interop