How can I observe a specific element with Swift collection types using property observers?
问题 Inspired when answering the question of How do I know if a value of an element inside an array was changed?, The answer was using a Property Observer for checking if an array has been modified. However, How can I determine what is/are the updated element(s) in a collection type in a property observer? For example: class MyClass { var strings: [String] = ["hello", "world", "!"] { didSet(modifiedStrings) { print("strings array has been modified!!:") print(modifiedStrings) } } } let myClass =