如何枚举String类型的枚举?
enum Suit: String { case spades = "♠" case hearts = "♥" case diamonds = "♦" case clubs = "♣"}
例如,我该怎么做:
for suit in Suit { // do something with suit print(suit.rawValue)}
结果示例:
♠ ♥ ♦ ♣
慕的地6264312
相关分类