Swift copy-on-write
To understand what copy-on-write means we need to delve into Swift’s type classification.
Objects in Swift can be divided into two type groups: value types and reference types.
The main difference between the two is how they are managed in memory. Theoretically, Value types create a new copy on memory each time they are assigned to a new variable, conversely reference types share the same reference amongst all variables.
What is copy-on-write?