-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Mastering Swift 5.3
By :

In this chapter, we looked at the differences between value types and reference types. We also looked at how to implement copy-on-write and the Equatable
protocol with our custom types. We can implement the copy-on-write feature with value types that become very large. We can implement the Equatable
protocol for any custom type, including reference types, when we need to compare two instances.
While Swift takes care of managing the memory for us, it is still a good idea to understand how this memory management works so that we can avoid the pitfalls that may cause it to fail. In the next chapter, we will look at how memory management in Swift works and demonstrate how it can fail.