- 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.
推薦閱讀
- 數(shù)據(jù)驅(qū)動設(shè)計:A/B測試提升用戶體驗
- Hands-On Mathematics for Deep Learning
- 大數(shù)據(jù)架構(gòu)商業(yè)之路:從業(yè)務(wù)需求到技術(shù)方案
- Apache Kylin權(quán)威指南
- ECharts數(shù)據(jù)可視化:入門、實戰(zhàn)與進階
- MySQL核心技術(shù)手冊
- Scratch Cookbook
- 大數(shù)據(jù)用戶行為畫像分析實操指南
- MySQL 8.0從入門到實戰(zhàn)
- 實用數(shù)據(jù)結(jié)構(gòu)基礎(chǔ)(第四版)
- SQL應(yīng)用開發(fā)參考手冊
- 大數(shù)據(jù)理論與工程實踐
- Python數(shù)據(jù)分析入門與實戰(zhàn)
- 拿下Offer:數(shù)據(jù)分析師求職面試指南
- Internet of Things Programming with JavaScript