How can I get the value of a struct type by mean of a string?
func getField(action: myStruct, field:String) {
labelAmount.text = action[field]
}
This is my struct:
struct myStruct {
var id: Int
var name: String
.
.
//many fields
}
I get this error:
Value of type 'myStruct' has no subscripts