Swift - 40 - 보다 유연한 일일 사용 방식

749 단어
//: 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)
}

좋은 웹페이지 즐겨찾기