Swift 枚举enum
2020-12-13 05:57
标签:ace get direction col method 返回 space convert case enum methodType{ case get case post case put case delete } 枚举赋值 enum methodType:String{ case get="get" case post="post" case put="put" case delete="delete" } let type:methodType = .get let type2 = methodType.post let type3 = methodType(rawValue: "put")// 返回一个可选类型 值/nil let str=type3?.rawValue//打印字符串 "put" print(type) //省略写法 enum Direction:Int{ case east=0,west,north,south } print(Direction.north) Swift 枚举enum 标签:ace get direction col method 返回 space convert case 原文地址:https://www.cnblogs.com/dhui69/p/11158949.html
上一篇:在安装twincat plc时,出现 there are some files marked for deletion on next reboot.please reboot first then