Two variables can point to the same object, so changing one variable changes the other too. Having lots of objects point to the same data can be useful in some circumstances, but mostly we will want to modify copies so that modifying one object doesn't have an effect on the others. The foundation framework provides us the means to copy reference types. To make it work, we need to do the following:
- Our class should be of the NSObject type
- Our class should conform to the NSCopying protocol (which is not mandatory, but makes our intent clear for our API user)
- Our class should implement the copy(with: NSZone) method
- To copy the object, we will need to call the copy() method on the object
Here's an example of a Manager ...