title: Efficient way to remove duplicates in [AnyObject] Swift
body: <p>I have a swift array of [AnyObject]. Some objects have the same <code>RestaurantName</code>. What is the optimal (least resource intense) way to remove duplicates and keep the one with the highest <code>Votes</code></p>
  
  <p>Note: only the <code>objectId</code> is the same in <code>RestaurantName</code>, there is still a unique id associated with each.</p>
  
  <h3>Array of AnyObject</h3>
  
  <pre><code>Optional([&lt;FoodPhoto: 0x1741088b0, objectId: FNJjZHxOvg, localId: (null)&gt; {
      PhotoName = Test1;
      PhotoUploaded = "&lt;PFFile: 0x170460b00&gt;";
      RestaurantName = "&lt;Restaurant: 0x17010a4d0, objectId: 0aKFrpKN46&gt;";
      UserUploaded = "&lt;PFUser: 0x1703627c0, objectId: wNJPsJDV6t&gt;";
      Votes = 2;
  }, &lt;FoodPhoto: 0x17410ab90, objectId: yhiMZ3dkHR, localId: (null)&gt; {
      PhotoName = Title1;
      PhotoUploaded = "&lt;PFFile: 0x170460c00&gt;";
      RestaurantName = "&lt;Restaurant: 0x17010a7a0, objectId: 0aKFrpKN46&gt;";
      UserUploaded = "&lt;PFUser: 0x170362580, objectId: Zk56DgHGhi&gt;";
      Votes = 5;
  }, &lt;FoodPhoto: 0x17410ab00, objectId: UNTRadeMjg, localId: (null)&gt; {
      PhotoName = title2;
      PhotoUploaded = "&lt;PFFile: 0x170460cc0&gt;";
      RestaurantName = "&lt;Restaurant: 0x17010a8c0, objectId: 0aKFrpKN46&gt;";
      UserUploaded = "&lt;PFUser: 0x170362340, objectId: Zk56DgHGhi&gt;";
      Votes = 0;
  }, &lt;FoodPhoto: 0x17410ac20, objectId: 7C8voifUHd, localId: (null)&gt; {
      PhotoName = title3;
      PhotoUploaded = "&lt;PFFile: 0x170460d80&gt;";
      RestaurantName = "&lt;Restaurant: 0x17010a9e0, objectId: 0aKFrpKN46&gt;";
      UserUploaded = "&lt;PFUser: 0x1703624c0, objectId: Zk56DgHGhi&gt;";
      Votes = 0;
  }])
  </code></pre>