i have a small problem. I have two Arrays where i try to find the same content in it. So i decided to convert it to a Set and then using those nice functions with "subtract". However i get very different results. Can someone tell me why this happens? When i use "subtracting" instead of "subtract" i get no problems however this is very weird for me and i really have no clue why this happens.
var objectIDsWhichExist = [ "kjugsJHL6JYoByOreUQ0wUefsbX2", "18ixZ21PJDXA1WzeJqZzctl7tTk2", "ZeQPYGfDvWMLSVykb4M5FQ6miGX2"]
var helperObjectIDsWhichExistInAdded = [ "kjugsJHL6JYoByOreUQ0wUefsbX2", "18ixZ21PJDXA1WzeJqZzctl7tTk2"]
var setA = Set(objectIDsWhichExist) /* Updated Data*/
var setB = Set(helperObjectIDsWhichExistInAdded) /* Standard Data*/
let different = setA.subtract(setB) // I GET HERE ()
print(different) // I GET THIS RESULT "()\n"
And this is the one sample which works, surprisingly. However i still dont know really why???
var employees: Set = Set(objectIDsWhichExist)
let neighbors: Set = Set(helperObjectIDsWhichExistInAdded)
employees.subtract(neighbors)
print(employees) // HERE IT DOES WORK because i get this -> ["ZeQPYGfDvWMLSVykb4M5FQ6miGX2"]\n"