Is the mutability of Swift containers shallow? Or can an element be mutated in place?
问题 I have a collection of objects in a Set . The objects' type follows GeneratorType , so I have a mutating method next . Although I can mutate the set by adding/removing elements, I don't know how to mutate an element. Using both for-in statement and the forEach method give errors about the element being immutable. Is the mutability of Swift containers shallow? Is there a way to call a mutating method on a contained element? Does it work for other collection/sequence types besides Set ? (My