I have a JSON response like this from my API:
SUCCESS: {
data = (
{
addressDescription = "";
addressLine1 = "30 xxx Street";
addressLine2 = xxx;
addressLine3 = "";
addressType = 1;
city = Lagos;
country = Nigeria;
id = xxx;
state = Lagos;
},
{
addressDescription = "AAA";
addressLine1 = "11 bbb Street,";
addressLine2 = "Ikeja";
addressLine3 = "";
addressType = 1;
city = Lagos;
country = Nigeria;
id = xxx;
state = Lagos;
}
);
My Swift code looks like this:
var productsArray = [AnyObject]()
Alamofire.request(URL).responseJSON {
response in
//printing response
print(response)
//getting the json value from the server
let result = response.result
if let dict = result.value as? Dictionary<String,AnyObject> {
if let innerDict = dict["data"]{
self.addyArray = innerDict as! [AnyObject]
}
}
}
How do I get the individual fields (addressLine1, addressLine2, etc) in this array to show in my UIPickerView? Any help will be appreciated.