I'm working on a swift project and I have a couple of arrays. In one of my arrays, I do not want the client to be able to mutate it without using one of my specially-defined methods. On the other hand, I want the getter to be accessible. My questions comes up regarding append and setting properties.
Question 1: Does private(set)
stop clients from calling array.append
?
On another array I want to see if it has been changed.
Question 2: If I add a property observer onto the array using didSet
, then is the didSet
called when an element is appended to the array?