Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
struct Industry: Encodable {
let industryTypeCode: String
}
struct Company: Encodable {
let companyName: String
let cinNumber: String
let isListed: Bool
let industryType: [Industry]
}
struct Address: Encodable {
let address: String
let countryCode: String
}
struct RequestPayload: Encodable {
let basicDetail: Company
let addressDetail: Address
}
func sendRequest() {
let industries = [Industry(industryTypeCode: "4AC0C192"), Industry(industryTypeCode: "2E128A3A")]
let basics = Company(companyName: "Abhishek", cinNumber: "1234565", isListed: false, industryType: industries)
let address = Address(address: "dfd\ndf", countryCode: "050822CF")
let requestPayload = RequestPayload(basicDetail: basics, addressDetail: address)
AF.request(url, method: .post, parameters: requestPayload, encoder: JSONParameterEncoder.default)
.responseJSON { response in
switch response.result {
case .success(let value):
print(value)
case .failure(let error):
print(error)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.