title: Issue with removing from array
body: <p>I'm trying to check whether an object (order of type Order) already exists in an array (newOrderItems - array of Order) before appending it so that I avoid duplicates.</p>
  
  <p>Array declaration:</p>
  
  <pre><code>var newOrderItems = [Order]()
  </code></pre>
  
  <p>Attempting to delete if exists before appending:</p>
  
  <pre><code>let order = Order(item: item!.name, price: item!.price, quantity: 1, status: "", tags: "", selectedTags: item!.selectedTags, id: item!.id)
  
  if newOrderItems.filter({ $0 == order }).count &gt; 0 {
      newOrderItems.removeAtIndex(newOrderItems.indexOf(order))
  }
  
  newOrderItems.append(order!)
  </code></pre>
  
  <p>The above gives 2 errors:</p>
  
  <p>****** Error 1 ******</p>
  
  <p>Binary operator '==' cannot be applied to operands of type 'Order' and 'Order?'</p>
  
  <p>in line:</p>
  
  <pre><code>if newOrderItems.filter({ $0 == order }).count &gt; 0
  </code></pre>
  
  <p>****** Error 2 ******</p>
  
  <p>Cannot convert value of type 'Order?' to expected argument type '@noescape (Order) throws -> Bool'</p>
  
  <p>in line:</p>
  
  <pre><code>newOrderItems.removeAtIndex(newOrderItems.indexOf(order))
  </code></pre>
  
  <p>What am I missing here?</p>
  
  <hr>
  
  <p>****** EDIT ******</p>
  
  <p>I can get it to work if I rewrite it using a loop:</p>
  
  <pre><code>var counter = 0
  
  for item in newOrderItems {
  
      if item.id == order?.id {
          newOrderItems.removeAtIndex(counter)
          break
      }
      counter++
  }
  newOrderItems.append(order!)
  </code></pre>