Challenge
Your challenge is to make an enum with the three Microsoft CEOs: Bill Gates, Steve Ballmer, and Satya Nadella. Make Satya Nadella the default, and add a description() method. Design your enum so that the following code works:
let currentCEO = MicrosoftCEOs() println(currentCEO.description()) let oFirstCEO = MicrosoftCEOs.fromRaw(1) if let firstCEO = oFirstCEO { println(firstCEO.description()) } else { println("No such value") } |
Video Tutorial: Introduction to Swift Part 9: Enums is a post from: Ray Wenderlich
The post Video Tutorial: Introduction to Swift Part 9: Enums appeared first on Ray Wenderlich.