How to use Observation to actually observe changes to a property

Thank you for the example. Although it works it .... doesn't look very nice :) Ideally I would expect something like:

let sourceOfTruth = SourceOfTruth()
let observation = withContinousObservation(of: sourceOfTruth.data) { data in
   // do something when data changes
}

or

let sourceOfTruth = SourceOfTruth()
let dataPublisher = $sourceOfTruth.data.publisher()

Maybe someone figured out a way to somehow wrap the property of an Observable in a Publisher?

2 Likes