I think the reason change appears with nil is because you did not specify parameters.
Rewrite as follows:
override func viewDidLoad() { super.viewDidLoad() // configure the observation token = self.observe(\.dishes, options: [.new,.old]) { object, change in print(object) let set1 = Set(change.newArray!) let set2 = Set(change.oldArray!) let filter = Array(set1.subtract(set2)) print(filter) } updateTableView() }
Please note that I have a little clue about your Dish object. I assume that you followed the Equatable protocol, and this is a necessary step for the solution to work.
source share