今日份swift学习5

枚举,结构体和类 1.枚举 枚举能为一组相关值定义一个相同的类型 我们通过enum关键字来声明一个枚举类型 ex:enum Direction { case east case west case south case north } 也可以声明在一个case中用逗号隔开 当我们声明一个枚举类型时,就等于我们声明了一个新的swift数据类型,可以像使用Int String那样使用它 ex:var
相关文章
相关标签/搜索