Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
protocol LocalizableDelegate {
var rawValue: String { get } //localize key
var table: String? { get }
var localized: String { get }
}
extension LocalizableDelegate {
//returns a localized value by specified key located in the specified table
var localized: String {
return Bundle.main.localizedString(forKey: rawValue, value: nil, table: table)
}
// file name, where to find the localized key
// by default is the Localizable.string table
var table: String? {
return nil
}
}
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.