Skip to content

Instantly share code, notes, and snippets.

@damijanracel
Last active October 15, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damijanracel/ef5425f799f5da992219306795ec6deb to your computer and use it in GitHub Desktop.
Save damijanracel/ef5425f799f5da992219306795ec6deb to your computer and use it in GitHub Desktop.
LocalizationKey enum with parameters
enum LocalizationKey {
case hello
case bye(String)
case progress(Int, Int)
var string: String {
switch self {
case .hello:
return "hello".localized()
case .bye(let name):
return String(format: "bye".localized(), name)
case .progress(let from, let to):
return String(format: "progress".localized(), from, to)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment