Please look at that code:
class Mut {
var zetstruct = MutStr(z: 5) {
didSet {
print("struct was change")
zetstruct.addZet(num: 10)
}
}
struct MutStr {
var z: Int
mutating func addZet(num: Int) {
z += num
}
}
func work() {
zetstruct.addZet(num: 10)
}
}
let mut = Mut()
mut.work()
Why in this case we don't have infinity cycle? Because when we change struct's
property within mutating function it cause that instance property 'zetstruct'
change and didSet invocate.
--
Седых Александр
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users