You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for a way to map/decode json values to custom Enums.
For instance my API return status value which may be something like -1, 0 or 1
I also have an enum:
enum Status: Int {
case deleted = -1
case inactive = 0
case active = 1
}
Can I map these together? I tried implementing a custom mapper from your example buy it doest seem to accept custom types, such as Status . I want to be able to do something like this:
return Status(rawValue: -1)
and get my custom type
The text was updated successfully, but these errors were encountered:
Hi,
I'm looking for a way to map/decode json values to custom Enums.
For instance my API return
status
value which may be something like -1, 0 or 1I also have an enum:
Can I map these together? I tried implementing a custom mapper from your example buy it doest seem to accept custom types, such as
Status
. I want to be able to do something like this:return Status(rawValue: -1)
and get my custom type
The text was updated successfully, but these errors were encountered: