//: Playground - noun: a place where people can play import UIKit /*
这里的枚举没有给它的成员默认值, 而是给它绑定了一个类型,
之后可以在程序中对这些成员进行赋值
*/
enum Barcode
{
case UPCA(Int, Int, Int, Int) // 条形码
case QRCode(String) // 二维码
} // 示例
let productCodeA = Barcode.UPCA(4, 102, 245, 8)
let productCodeB = Barcode.QRCode("This is a QRCodeInfomation") switch productCodeA {
case .UPCA(let systemNumber, let manufacture, let identifier, let check):
print("UPC-A with value of \(systemNumber), \(manufacture), \(identifier), \(check)")
case .QRCode(let info):
print(info)
}