It's well-known that, of course, didSet will not run on the same object again from inside a didSet. (example.)
However. It seems that: the restriction applies not only to that object, but to maybe any object of the same class.
Here are copy-paste test cases for Playground.
class C {
var Test: Bool = false {
didSet {
print("test.")
for c in r {
c.Test = true
}
}
}
var r:[C] = []
}
var a:C = C()
var b:C = C()
var c:C = C()
a.r = [b, c]
a.Test = false
Does not work!
class C {
var Test2: Bool = false {
didSet {
print("test2.")
global.Test2 = true
}
}
}
var global:C = C()
var a:C = C()
a.Test2 = false
Does not work!
Is this a Swift bug?
If not, what is the actual restriction? It won't run ANY didSet (whatsoever) that starts from a didSet?; the same identical class?; the same super class?; or?
Where exactly is this explained in the doco?
WTF. One needs to know ... what is the actual restriction specifically?