I'm implementing Apple's example of using enums to create a Card struct
, but the simpleDescription()
method doesn't work. Apple suggests:
struct Card {
var rank: Rank
var suit: Suit
func simpleDescription() -> String {
return "The \(rank.simpleDescription()) of \(suit.simpleDescription())"
}
}
but when I call
let card = Card(rank: .queen, suit: .hearts)
print("card = \(Card(rank: .queen, suit: .hearts))")
the console prints out
card = Card(rank: twoMatch.Rank.queen, suit: twoMatch.Suit.hearts)
where "twoMatch" is the name of my app, and ignores the string I've constructed in simpleDescription()
. I've checked the method signature several times and have even copied it over from the examples in Rank
and Suit
, which work just fine.