In Objective-C, the NSIndexSet
can removeIndexes:(NSIndexSet *)indexSet
:
[aIndexSet removeIndexes: bIndexSet];
Is there some way to do this with IndexSet
in Swift like the NSIndexSet
in Objective-C?
There is a function, from the documentation
mutating func subtract(_ other: IndexSet)
Removes the elements of the given set from this set.
var aIndexSet = IndexSet(integersIn: 0..<7)
let bIndexSet = IndexSet(integersIn: 4..<12)
aIndexSet.subtract(bIndexSet)
print(aIndexSet) // 0..<3