Created
January 15, 2018 09:52
-
-
Save agoiabel/7676f7f6b3023f304804077ecab895dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum AppleDevice { | |
case iPad, iPhone, AppleTv, AppleWatch | |
func description() -> String { | |
switch self { | |
case .iPad: return "\(self) was introduced 2006" | |
case .iPhone: return "\(self) was introduced 2007" | |
case .AppleTv: return "\(self) was introduced 2010" | |
case .AppleWatch: return "\(self) was introduced 2014" | |
} | |
} | |
} | |
AppleDevice.iPad.description() //will return "iPad was introduced 2006" | |
AppleDevice.iPhone.description() //will return "iPhone was introduced 2007" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment