Avatar
omochimetaru 3/17/2023 9:30 AM
Observation Proposal: SE-NNNN Authors: Philippe Hausler, Nate Cook Review Manager: TBD Status: Awaiting implementation Changes Pitch 1: Initial pitch Pitch 2: Previously Observation registered observers directly to Observable, the new approach registers observers to an Observable via a ObservationTransactionModel. These models control th...
9:31 AM
Observationも更新されました computed propertyも購読できるようにするために、
9:31 AM
extension MyObject { var someComputedProperty: Int { somePrivateProperty + someOtherProperty } nonisolated static func dependencies( of keyPath: PartialKeyPath<Self> ) -> TrackedProperties<Self> { switch keyPath { case \.someComputedProperty: return [\.somePrivateProperty, \.someOtherProperty] default: return [keyPath] } } }
👍🏻 1
9:32 AM
ユーザーがcomputed propertyが依存するプロパティを定義できるようです これならたしかに動きそう