OpenCombine icon indicating copy to clipboard operation
OpenCombine copied to clipboard

Bug: Combine's `ObservableObject` doesn't use `Mirror`

Open amomchilov opened this issue 1 year ago • 0 comments

The "real" Combine doesn't use Mirror to implement ObservableObject as discussed in this thread: https://forums.swift.org/t/how-is-the-published-property-wrapper-implemented/58223/11

Instead, it uses the private _forEachField(of:options:body) reflection method from the standard library.

This isn't a mere difference in implementation details either, it has an observable (heh, pun intended) difference: OpenCombine's behaviour can be hooked by conforming to CustomReflectable, whereas "real" Combine ignores it. PoC: https://github.com/OpenCombine/OpenCombine/pull/255

amomchilov avatar Sep 02 '24 17:09 amomchilov