Problem Statement
Compare how memory management works for value types (struct/enums) and reference types (classes) in Swift.
Explanation
In Swift value types (structs, enums) do not use ARC. When you assign or pass a value type, it is copied (or optimized by the compiler) and you get independent instances. This means you don’t worry about reference counts or retain cycles for value types. /n/n Reference types (classes) are managed by ARC: each instance has a reference count increased by strong references. When the count drops to zero the instance is deallocated, but retain cycles or misuse of strong references can keep them alive unexpectedly. Understanding this difference helps you design types that are safe and efficient, avoiding memory leaks and unintended sharing of mutable state.