Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 384 Bytes

README.md

File metadata and controls

17 lines (15 loc) · 384 Bytes

Enums

Enums can optionally be of a specific type or on their own. They can contain methods like classes.

enum Suit {
    case Spades, Hearts, Diamonds, Clubs
    func getIcon() -> String {
        switch self {
        case .Spades: return "♤"
        case .Hearts: return "♡"
        case .Diamonds: return "♢"
        case .Clubs: return "♧"
        }
    }
}