Last active
October 15, 2018 10:22
-
-
Save damijanracel/ef5425f799f5da992219306795ec6deb to your computer and use it in GitHub Desktop.
LocalizationKey enum with parameters
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
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