Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Localization struct upgrade
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
You can’t perform that action at this time.