Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
//In the code block below. What are both self methods refering to? do both self methods refer to the Suit enum because it is inside the enum block? I am trying to better understand self. Please see link for expanded question.
enum Suit {
case spades, hearts, diamonds, clubs
var rank: Int {
switch self {
case .spades: return 4
case .hearts: return 3
case .diamonds: return 2
case .clubs: return 1
}
}
func beats(_ otherSuit: Suit) -> Bool {
return self.rank > otherSuit.rank
}
}
https://code.sololearn.com/c9KIG0ab...
question
enum
apple
switch
self method
swift
xcode