30
如何枚举String类型的枚举?
enum Suit: String { case spades = "♠" case hearts = "♥" case diamonds = "♦" case clubs = "♣" } 例如,我该怎么做: for suit in Suit { // do something with suit print(suit.rawValue) } 结果示例: ♠ ♥ ♦ ♣
由一组命名值组成的数据类型,这些命名值称为该类型的元素,成员或枚举数。