I have the following code in Swift 4, on Xcode 10
var newCard = deck.randomElement()!
deck.remove(at: deck.firstIndex(of: newCard)!)
dealtCards.append(newCard)
I'm trying to take a random element from deck: [SetCard] and place it into dealtCards: [SetCard]
However, Xcode gives me the following error:

I've been looking through the documentation, but as far as I can tell, func firstIndex(of element: Element) -> Int? is a method that exists in Array, so I don't understand why Xcode wants me to change 'of' to 'where', when the function has the exact behaviour I want.
What am I missing here?