Created
November 10, 2020 13:54
-
-
Save mkeremkeskin/87d2f4f147b3a0c8183f3b72f4020423 to your computer and use it in GitHub Desktop.
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
public enum FilterType: String, BaseSelectionType, CaseIterable { | |
case colorDocument = "colorDocumentLocalization" | |
case blackAndWhite = "blackAndWhiteLocalization" | |
case colorPhoto = "colorPhotoLocalization" | |
case greyscale = "greyscaleLocalization" | |
case general = "generalLocalization" | |
func localizedString() -> String { | |
return NSLocalizedString(self.rawValue, comment: "") | |
} | |
init(backendId: Int) { | |
switch backendId { | |
case 11: self = .colorDocument | |
case 22: self = .blackAndWhite | |
case 33: self = .colorPhoto | |
case 44: self = .greyscale | |
default: self = .general | |
} | |
} | |
} | |
// custom initialization example | |
let type = FilterType(id: 22) | |
print(type.localizedString()) | |
//prints Black and White |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment