title: How to compare two array of objects?
body: <p>I have a class A:</p>
  
  <pre><code>class A {
     var identifier: String?
     var quantity: Int = 0
  }
  </code></pre>
  
  <p>Two arrays of A instances:</p>
  
  <pre><code>var array1: [A] = [a1, a2, a3, a4]
  var array2: [A] = [a5, a6, a7, a8]
  </code></pre>
  
  <p>I don't know which is the best way to check:
  <code>array1==array2 if a1.identifier == a5.identifier, a2.identifier == a6.identifier, a3.identifier==a7.identifier, a4.identifier==a8.identifier</code> in Swift.</p>
  
  <p>Please help me...</p>