Created
November 19, 2014 20:36
-
-
Save thinkclay/ab0112492d6e4605ebc0 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
| class CurrencyFactory | |
| { | |
| class func currencyForCountry(country:Country) -> Currency? | |
| { | |
| switch country | |
| { | |
| case .Spain, .France : | |
| return Euro() | |
| case .UnitedStates : | |
| return UnitedStatesDolar() | |
| default: return nil | |
| } | |
| } | |
| } | |
| let noCurrencyCode = "No Currency Code Available" | |
| CurrencyFactory.currencyForCountry(.Spain)?.code() ?? noCurrencyCode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment