- Hands-On Design Patterns with Swift
- Florent Vilmart Giordano Scalzo Sergio De Simone
- 62字
- 2021-07-02 14:44:58
Simple enums
Let's say you're building a smart light remote control; you can easily represent the state of this light with the following enum:
enum State {
case on
case off
}
let anOnLight = State.on
This is a very simple example, and we could have used a Boolean value, but with the enum, we set ourselves up for expansion.
推薦閱讀
- 在你身邊為你設計Ⅲ:騰訊服務設計思維與實戰
- 數據分析實戰:基于EXCEL和SPSS系列工具的實踐
- Oracle RAC 11g實戰指南
- Hadoop與大數據挖掘(第2版)
- 智能數據時代:企業大數據戰略與實戰
- Proxmox VE超融合集群實踐真傳
- gnuplot Cookbook
- 數據科學工程實踐:用戶行為分析與建模、A/B實驗、SQLFlow
- 重復數據刪除技術:面向大數據管理的縮減技術
- 探索新型智庫發展之路:藍迪國際智庫報告·2015(上冊)
- MySQL技術內幕:SQL編程
- 從Lucene到Elasticsearch:全文檢索實戰
- 大數據測試技術:數據采集、分析與測試實踐(在線實驗+在線自測)
- Artificial Intelligence for Big Data
- 深入理解Flink:實時大數據處理實踐