I have 2 sections in my tableview. Section 0 has data from an array and section 1 has data from an api. Now I want to check if the data from section 0 has a matching data to that of section 1 then I want to remove that particular entry from section 1. Not sure how to do that…
I have 2 arrays which populate data in each of the sections:
filteredSelectedProductList —> Section 0
productsList —> Section 1
This is the code I have:
if self.filteredSelectedProductList.isEmpty == false {
for prod in self.filteredSelectedProductList { //section 0
for filtProd in productsList { //section 1
if prod.productId == filtProd.productId {
//Here I want to remove the matching entry from productsList array. How can I do that..?
}
}
}
}