emum City{
case Beijing = 0,Shanghai,Guangzhou
static let allValues = [Beijing Shanghai,Guangzhou]
}
遍历:
for city in City.allValues{
print(city)
}
显示枚举名称对应的字符串:
let city = City.Beijing
let beijing ="\(city)"
print(beijing)
emum City{
case Beijing = 0,Shanghai,Guangzhou
static let allValues = [Beijing Shanghai,Guangzhou]
}
遍历:
for city in City.allValues{
print(city)
}
显示枚举名称对应的字符串:
let city = City.Beijing
let beijing ="\(city)"
print(beijing)