[swift-users] struct property changing calls didSet of the Struct each time, but class won't

Tino Heth 2th at gmx.de
Mon Nov 13 10:25:49 CST 2017


> My code depends on the class version didSet but I used the struct version. It took me a long time to debug this out. Is this a knowledge that has been well known already?
Yes, that’s how it’s supposed to be.
It’s a feature of struct which isn’t available with classes (so considering the Objective-C past, the „surprise“ is actually that didSet is called when you do that change to a struct property).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20171113/6575d84a/attachment.html>


More information about the swift-users mailing list