Created
October 11, 2018 14:40
-
-
Save damijanracel/51590f14e36287f825b3e6dd0ca9e98f to your computer and use it in GitHub Desktop.
Localization struct upgrade
This file contains 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
struct Localization { | |
let key: LocalizationKey | |
let string: String | |
private init(string: String, key: LocalizationKey) { | |
self.string = string | |
self.key = key | |
} | |
static func bye(name: String) -> Localization { | |
return Localization(string: String(format: LocalizationKey.bye.string, name), key: .bye) | |
} | |
static func hello() -> Localization { | |
return Localization(string: LocalizationKey.hello.string, key: .hello) | |
} | |
static func progress(from: Int, to: Int) -> Localization { | |
return Localization(string: String(format: LocalizationKey.progress.string, from, to), key: .progress) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment