I have a table with a column named “gender” with possible values of “F”, “M”, “U” as strings.
How can I map this to an enum in my data object in Swift?
enum Gender: String {
case Female = "F"
case Male = "M"
case Unisex = "U"
init(_ value: String) {
self.init(rawValue: value)!
}
}
What I want is something like:
enum Gender: String {
case Female = "F"
case Male = "M"
case Unisex = "U"
init(_ value: String) {
self.init(rawValue: value)!
}
}
Thanks