April 2017
Intermediate to advanced
316 pages
9h 33m
English
Assignment operations on value types copy values from one value type to another value type. There are two types of copying in different programming languages, shallow and deep copying.
Shallow copying duplicates as little as possible. For instance, a shallow copy of a collection is a copy of the collection structure, not its elements. With a shallow copy, two collections share the same individual elements.
Deep copying duplicates everything. For instance, a deep copy of a collection results in another collection with all of the elements in the original collection duplicated.
Swift does the shallow copying and does not provide a mechanism for deep copying. Let's examine an example to understand shallow copying:
let julie = User(name: ...
Read now
Unlock full access