Christian Tietze

  • Blog Posts
  • Writing
  • Apps
  • Work With Me
  • Contact

Mutating Struct and State Observers: How the Latter Will Be Notified Even for 'No-Ops'

Nov 29th, 2022

I may be 7 years late or so – but until last week, I didn’t realize that didSet property observers would fire when the observed property hasn’t actually changed. All you need is a mutating func that doesn’t even need to mutate. This can be illustrated with a simple piece of code:

Continue reading …

  • ∞ Permalink
  • • Comments
  • • Tags:
    • value-object
    • swift
    • reswift
    • mutation
    • performance

Contact • Newsletter • Blog Feed • /feeds • /now • /uses • @ctietze@mastodon.social • Privacy & Legal Information

Except where otherwise noted, content on this site is licensed CC BY-SA 4.0.

As an Amazon Associate I earn from qualifying purchases. This e.g. applies to links to Amazon.com.