I’ve just open-sourced SBSObservation. It reimplements Apple’s Observation framework and backports it to iOS 12 with similar internals and a more ergonomic API.
The code is for inspiration and learning, provided as-is with no guarantees.
GitHub - simonbs/SBSObservation: Tiny observation framework designed for UIKit-based apps and built with Swift macros. It automatically handles the deallocation of observations and supports iOS 12 and newer.
Tiny observation framework designed for UIKit-based apps and built with Swift macros. It automatically handles the deallocation of observations and supports iOS 12 and newer. - simonbs/SBSObservation