码迷,mamicode.com
首页 > 编程语言 > 详细

swift语言点评八-枚举

时间:2018-04-03 19:10:33      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:nbsp   values   point   log   value   mat   character   comm   oci   

总结:swift中的枚举可以看作变量可以作为case匹配参数的类

 

Enumerations

 枚举的作用:状态列举与匹配

 

枚举值与类型

If a value (known as a “raw” value) is provided for each enumeration case, the value can be a string, a character, or a value of any integer or floating-point type.

You can define a common set of related cases as part of one enumeration, each of which has a different set of values of appropriate types associated with it.

 

Enumerations in Swift are first-class types in their own right.

computed properties

instance methods

继承、协议

 

case

 

简化

 

match

 

.语法

 

swift语言点评八-枚举

标签:nbsp   values   point   log   value   mat   character   comm   oci   

原文地址:https://www.cnblogs.com/feng9exe/p/8710270.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!