Codable Hierarchies |

This is a companion discussion topic for the original entry at


There is, apparently, a known issue in the current release of Xcode 11.4.1 (which contains Swift 5.2) where didSet and willSet are not getting called if you append an item to an array, amongst other things.

Apparently Xcode 11.5 (currently in Beta) fixes this. As a workaround what I am reading will work is entirely reassigning the actual array property, not just appending. This can be achieved buy updating the code starting on line 58 inside NewTaskView.swift to:

Button("Add") {
  let priorityIndex = self.taskStore.getIndex(for: self.priority)
  var updatedPrioritizedTasks = self.taskStore.prioritizedTasks
      Task(name: self.text)
  self.taskStore.prioritizedTasks = updatedPrioritizedTasks

This, when setting a breakpoint on line 43 of TaskStore.swift will successfully make the call as it should have prior to this bug being introduced.

Fortunately there is a workaround for now, and also a fix is incoming in the next version of Xcode.

Let me know if that works, this is the first time I actually have ran into a regression of the Swift language :slight_smile: You should now have your new tasks being saved immediately upon adding them both using JSON and Property Lists.

1 Like

@airjordan12345 Thank you for sharing this - much appreciated!