Advertisement
wpl36

пастебин

Jun 17th, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import UIKit
  2.  
  3. enum Device {
  4. case iPad(color: String), iPhone(color:String)
  5.  
  6. var year: Int {
  7. switch self {
  8. case .iPhone: return 2007
  9. case .iPad(let color) where color == "black": return 2020
  10. case .iPad: return 2010
  11. case .iPhone(let color) where color == "white": return 2022
  12.  
  13. }
  14. }
  15. }
  16. let yearOfProd = Device.iPhone(color: "red").year
  17. let yOfP = Device.iPhone(color: "white").year
  18. let yearOfProduction = Device.iPad(color: "black").year
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement