enum Type: Int{
case A=1
case B=3
//普通方法
func toString()->String{
var info=""
switch self{
case .A:
info = "一"
case .B():
info = "三"
}
return info
}
//静态方法
static func toString(let type:Type)->String{
return "toString() -> \(type)"
}
// 成员
var description:String{
var info=""
switch self{
case .A:
info = "一"
case .B():
info = "三"
}
return "description field = \(type)"
}
}
let type = Type.B
print(Type.toString(type))
print(type.description)
//toString() -> B
//description field = B