Say I had two arrays:
var arrayA = ["Yes", "Yes2", "Not Answered", "No"]
var arrayB = ["Yes", "NA", "Yes2", "NA"]
And I wanted to remove the "NA"s from arrayB by doing:
var filtered = arrayB.filter({$0 != "NA"})
How could I remove the items at the same indexes removed in arrayA. I thought about using the find() function, but that only returns the first index a string appears. You can remove overlap from the arrays by:
let res = arrayA.filter { !contains(arrayB, $0) }
but how could I filter an array based on the filtering of another array?
the result would have:
arrayBFiltered = ["Yes", "Yes2"]
arrayAFiltered = ["Yes", "Not Answered"]
Any ideas?