Copy-On-Write(COW)
<p>A couple of years ago, during an interview, I was asked a question related to Copy-On-Write (COW). The interviewer asked:</p>
<p>“Are collections value or reference types in Swift? What should happen when you’re creating and assigning an array to another variable?”</p>
<p>I answered the second question incorrectly. Let’s delve into what’s happening here and why. In Swift, collections have value semantics. This means that when you create an Array, Dictionary, String, or any other collection in Swift, it’s a value type. For example, consider the code below:</p>
<p><a href="https://medium.com/@tigran.gishian/copy-on-write-cow-217d2a5148c9"><strong>Read More</strong></a></p>