0

I have an enum with a bunch of data, and there is a request from the server that returns a string - the key to this enum.

How do I dynamically call the value of this enum

public enum Solid: String{
     case val1 = "value1"
     case val2 = "value2"
     …
}

let serverResponce : String = "val1"

let getValFromEnum = Solid.serverResponce

And of course on the last line there is an error that Solid enum has no member 'serverResponce'

How can I solve this point?

0 Answers0