Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- enum Device {
- case iPad(color: String), iPhone(color:String)
- var year: Int {
- switch self {
- case .iPhone: return 2007
- case .iPad(let color) where color == "black": return 2020
- case .iPad: return 2010
- case .iPhone(let color) where color == "white": return 2022
- }
- }
- }
- let yearOfProd = Device.iPhone(color: "red").year
- let yOfP = Device.iPhone(color: "white").year
- let yearOfProduction = Device.iPad(color: "black").year
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement