Here's a snippet of code where I get a syntax error I don't understand:
let deal:[Card] = self.cards
for hand in hands {
var data:[Int] = []
for card:Card in hand.cards {
let idx = deal.indexOf(card)
data.append(idx!)
}
}
The error I get is "Cannot invoke 'indexOf' with an argument of type '(Card)'". I don't understand this at all. deal is an [Card]. What should I invoke deal.indexOf with if not a Card? The signature for CollectionType.indexOf in the docs is
func indexOf(element: Self.Generator.Element) -> Self.Index?
If deal is an [Card] isn't Self.Generator.Element equal to Card? I even put in type annotations to check that my variables have the types I expect. What am I missing? (As it happens Card is a struct, but I get the same error if I change it to a class.)