title: Using firstIndex(of: Element) in Swift
body: <p>I have the following code in Swift 4, on Xcode 10</p>
  
  <pre><code>        var newCard = deck.randomElement()!
  
          deck.remove(at: deck.firstIndex(of: newCard)!)
          dealtCards.append(newCard)
  </code></pre>
  
  <p>I'm trying to take a random element from <code>deck: [SetCard]</code> and place it into <code>dealtCards: [SetCard]</code></p>
  
  <p>However, Xcode gives me the following error:
  <a href="https://i.stack.imgur.com/f3XCf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f3XCf.png" alt="Xcode error"></a></p>
  
  <p>I've been looking through the documentation, but as far as I can tell, <code>func firstIndex(of element: Element) -&gt; Int?</code> is a method that exists in <code>Array</code>, so I don't understand why Xcode wants me to change 'of' to 'where', when the function has the exact behaviour I want.</p>
  
  <p>What am I missing here?</p>