AceMobileInterview

iOS track

General topic questions

Value vs Reference Types

EasyCommon

Free section · general topics & algorithms

Explain value types vs reference types and how copying behaves.

Reveal model answer
Value types (struct/enum) copy on assignment; reference types share one instance. Mutations to a copy don’t affect the original. Copy-on-write optimizes large values like Array/Dictionary/String.
Optionals and Nil CoalescingStructs vs Classes