0

I have 2 arrays. I want to find out the difference between those two. How to achieve them?

let totalData = [feed(id: "1", value: "100"),feed(id: "1", value: "200"),feed(id: "1", value: "300"),feed(id: "2", value: "100"),feed(id: "2", value: "200"),feed(id: "4", value: "100")]
let favData = [feed(id: "1", value: "100"),feed(id: "1", value: "200"),feed(id: "2", value: "100"),feed(id: "2", value: "100"),feed(id: "4", value: "100")]
let differenceData = [feed(id: "1", value: "300"),feed(id: "2", value: "200")]
pacification
  • 5,838
  • 4
  • 29
  • 51
user1960279
  • 494
  • 1
  • 8
  • 24
  • Does `feed` conform to the `Equatable protocol`? Does the ordering of the output matter? – Dávid Pásztor Sep 14 '17 at 09:50
  • @LorenzoB if I get the question right, OP is actually looking for the unique values and doesn't care about the indexes being the same. While the other question checks whether the two elements at the same index of the different arrays are the same – Dávid Pásztor Sep 14 '17 at 09:57

0 Answers0