I was wondering how one would go about comparing 2 boolean arrays and listing the non matching booleans.
I have written up a simple example of 2 arrays.
Xcode 11 has it supported
https://developer.apple.com/documentation/swift/array/3200716-difference
let oldNames = ["a", "b", "c", "d"]
let newNames = ["a", "b", "d", "e"]
let difference = newNames.difference(from: oldNames)
for change in difference {
switch change {
case let .remove(offset, oldElement, _):
print("remove:", offset, oldElement)
case let .insert(offset, newElement, _):
print("insert:", offset, newElement)
}
}
Output
remove: 2 c
insert: 3 e