Swift enum 독특한은 case 에 부여하고싶은 property를 부여시킬수있다는것이다
enum Device {
case iPad6(width:Double, height:Double, weight:Double)
case iPadAir(width:Double, height:Double, weight:Double)
case iPadPro(width:Double, height:Double, weight:Double)
}
struct AppleDevice {
var iPhone: Int
var iPad: Device
}
let myAppleDevice = AppleDevice(iPhone: 13, iPad:.iPadAir(width:540.5, height:700, weight:1.2))
print(myAppleDevice.iPad)
출력값: iPadAir(width: 540.5, height: 700.0, weight: 1.2)
caseProperty 사용가능!