2020-02-20-Swift-Form-Data-Request
Let's say, you've to send following request from iOS app.
curl -X POST \
https://some.server.com/api/endpoint \
-H 'cache-control: no-cache' \
-F 'signup[email]=user@mail.com' \
-F 'signup[password]=password' \
-F product_id=productidhere \
-F transaction_id=sometransactionidHere is the code to achieve it.
struct SignUpData {
let userEmail: String
let passData: String
let productId: String
let transactionId: String
var parameters: [String: Any] { [
"signup[email]": userEmail,
"signup[password]": passData,
"product_id": productId,
"transaction_id": transactionId,
"receipt": receipt
]
}
}Supporting percent Encoding with following code block
Last updated
Was this helpful?