I have an array of elements. I also have an IndexSet that specifies which indices of the array need to be extracted into a new array. E.g.:
let array = [\"su
You can use enumerated, filter and map like this
enumerated
filter
map
let result = array .enumerated() .filter { indexSet.contains($0.offset) } .map { $0.element }