Last active
September 22, 2019 05:40
-
-
Save robertmryan/d34c8c5499aa94ee9db05a619219e08f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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