I was thinking of using a plist file to configure how I would upload a form to my server but then I realised I don't know how I could do one crucial part of this or even if this is possible since you can't dynamically declare variables with swift.
Basically I was thinking of using a dictionary like this
form:
- property_name: backend_name
and then in my form upload method I would do something that would look like this
formValues: [String:String] = [:]
form.forEach { (property_name, backend_name) in
let value = someController[property_name] // to do the equivalent of someController.property_name
formValues[backend_name] = value
}
// ...
formValues.forEach { (backend_name, value) in
multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: backend_name)
}
the problem is I don't know how to this part
let value = someController[property_name]