Slide 13
Slide 13 text
*OMJOF!0CTFSWBCMF.BDSP
final class Child {
@ObservationTracked var age: Int
init(age: Int) {
self.age = age
}
func haveBirthday() {
age += 1
}
@ObservationIgnored private let _$observationRegistrar = Observation.ObservationRegistrar()
internal nonisolated func access(
keyPath: KeyPath
) {
_$observationRegistrar.access(self, keyPath: keyPath)
}
internal nonisolated func withMutation(
keyPath: KeyPath,
_ mutation: () throws -> MutationResult
) rethrows -> MutationResult {
try _$observationRegistrar.withMutation(of: self, keyPath: keyPath, mutation)
}
}
extension Child: Observation.Observable {
}