simonbs,
@simonbs@mastodon.social avatar

Can anyone think of a design pattern that makes it easy and safe to keep the state of child objects in sync with their parent? I.e. when a property is updated on a parent object, the new value should be forwarded to its children.

The naive approach is to override didSet on the parent's property and forward the new value to the children but it’s easy to forget to update the implementation of didSet when new children are introduced.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • slotface
  • kavyap
  • thenastyranch
  • everett
  • tacticalgear
  • rosin
  • Durango
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • InstantRegret
  • Youngstown
  • khanakhh
  • ethstaker
  • megavids
  • ngwrru68w68
  • cisconetworking
  • modclub
  • tester
  • osvaldo12
  • cubers
  • GTA5RPClips
  • normalnudes
  • Leos
  • provamag3
  • anitta
  • JUstTest
  • lostlight
  • All magazines