title: how to make a deep copy of a swift array of class objects
body: <p>So I know that swift array is implemented as struct, and it will do automatically copy by itself.</p>
  
  <p>I have write my class <code>MyClass</code> and I have implemented <code>copyWithZone</code> to make copy of it</p>
  
  <p>However, my swift array contains my <code>MyClass</code> objects, like:</p>
  
  <p><code>var array = [MyClass]()</code></p>
  
  <p>when I wan to make a copy of that array like</p>
  
  <p><code>var anotherArray = array</code></p>
  
  <p>It still does not call <code>MyClassObject.copyWithZone</code>, and later if I change the object property in <code>array</code>, <code>anotherArray</code> will also reflect the change.</p>
  
  <p>How can I make a copy of that <em>without</em> writing a for loop to iterate every object? </p>
  
  <p>It's not duplicated as <a href="https://stackoverflow.com/questions/32357060/deep-copy-for-array-of-objects-in-swift">deep copy for array of objects in swift</a> because I cannot use struct to rewrite my class.</p>