Following is the array I am receiving in response.
I have to show this data on UITableView where header title will be my transactionDate and items related to that date will go as number of rows in that section.
For below code, I have successfully pulled out unique dates from given list and I got 3 elements in unique date array.
Now I want another array which will have items associated to the date from unique date array.
So in result I should get 3 arrays for transactionDate value.
It should be like array1 with 2 value objects related to date 01/02/2021 array2 will be with 1 value related to date 27/01/2021 and array3 will be with 1 value object related to value to date 25/01/2021
This data will go on increasing as transactions for given date will go on, so some dynamic implementation is needed.
My all data elements are in array activityListArray which contains all these elements.
Among which I have filtered out unique dates as below,
for i in activityListArray{
date_array.append(i.transactionDate!)
}
let unique = Array(Set(date_array))
Now to get expected result what should I do next….?
Thanks in advance.
Response I am getting is below,
{
accountNumber = 0000078;
amount = 0;
buyingAmount = "277.42";
buyingCurrency = EUR;
currency = "";
customerInstruction = "0201000009958346-000000218";
payeeName = "Ash Roy";
reasonCode = "";
sellingAmount = "254.00";
sellingCurrency = GBP;
status = AWAITINGBANKAPPROVAL;
subType = "Payment without Fx";
transactionDate = "01/02/2021";
type = "";
},
{
amount = 0;
buyingAmount = "436.39";
buyingCurrency = GBP;
currency = "";
customerInstruction = "0201000009958346-000000210";
reasonCode = "";
sellingAmount = "788.00";
sellingCurrency = CAD;
status = PENDING;
subType = "Payment without Fx";
transactionDate = "27/01/2021";
type = "";
},
{
amount = 0;
buyingAmount = "436.39";
buyingCurrency = GBP;
currency = "";
customerInstruction = "0201000009958346-000000207";
reasonCode = "";
sellingAmount = "788.00";
sellingCurrency = CAD;
status = PENDING;
subType = "Payment without Fx";
transactionDate = "25/01/2021";
type = "";
},
{
amount = 0;
buyingAmount = "436.39";
buyingCurrency = GBP;
currency = "";
customerInstruction = "0201000009958346-000000206";
reasonCode = "";
sellingAmount = "788.00";
sellingCurrency = CAD;
status = PENDING;
subType = "Payment without Fx";
transactionDate = "01/02/2021";
type = "";
}
Dictionary(grouping:by)to do so.