enum
rank:
Int
{
caser1 =1 caser2 =2 caser3 =3 funcdescription()->String{//enum转String switch(self){ caser1: return@H_301_61@"R1"; caser2: "R2"; caser3: "R3"; } } } varr:rank=rank.r2;//普通初始化 varrraw =r.rawValue;//enum to int println(.description());//enum转String letnewr =rank(rawValue:3);//int to enum |