A property wrapper that forwards the objectWillChange of the wrapped ObservableObject to the enclosing ObservableObject's objectWillChange.
Just like @Published this sends willSet events to the enclosing ObservableObject's ObjectWillChangePublisher but unlike @Published it also sends the wrapped value's published changes on to the enclosing ObservableObject.
classOuter:ObservableObject{@PublishedObjectvarinnerPublishedObject:Inner@PublishedvarinnerPublished:Innerinit(_ value:Int){self.innerPublishedObject =Inner(value)self.innerPublished =Inner(value)}}classInner:ObservableObject{@Publishedvarvalue:Intinit(_ int:Int){self.value = int
}}func example(){letouter=Outer(1)
// Setting property on Outer (This will send an update with either @Published or @PublishedObject)
outer.innerPublishedObject =Inner(2) // outer.objectWillChange will be called outer.innerPublished =Inner(2) // outer.objectWillChange will be called
// Setting property on Inner (This will only send an update when using @PublishedObject)
outer.innerPublishedObject.value =3 // outer.objectWillChange will be called !!!
outer.innerPublished.value =3 // outer.objectWillChange will NOT be called }It's only one file so you could just copy it. Also has Swift Package Manager support.