Copy-On-Assignment vs. Copy-On-Write in Swift

Copy-on-write is a resource-management technique used to efficiently copy data, such as a Swift struct. It involves delaying the copy operation of the data until it's needed, usually when some part of the data is modified. In this post, Ayman Fayez shows us how to implement copy-on-write for a Swift struct which has a reference type as a property.