Wednesday, 29 September 2021

Swing5 filter list with 2 match strings

I have array of JSON in my swing5 application. So I want to filter array in base of a sing field of this array. So I m build this code:

This code are working

self.array = self.arrayFull({$o["status"].stringValue == "Pending"})

But I need to have a list with status == "Pending" or status == "Process"

What I should do to apply the filter on these 2 strings?

EDIT

The original code is:

//get all orders result by web service 
self.arrListAll = swiftyJsonVar["result"].arrayValue 
//filter the orders where status is Pending or Process 
self.arrListPending = self.arrListAll.filter({$0["status"].stringValue == self.st_pending || $0["status"].stringValue == self.st_driver_rejected}) 

This code works. But now to get the information of this array I must to use dictonary structure to get the value of this array for example:

let dic = arrListPending[indexPath.row]
let arr_productDetail = dic["item_data"].arrayValue
let strName = arr_productDetail.map({$0["item_name"].stringValue})

now I want to trasform this dictionary array to Object array.



from Swing5 filter list with 2 match strings

No comments:

Post a Comment