Skip to content

Commit

Permalink
Use up-to-date storage
Browse files Browse the repository at this point in the history
  • Loading branch information
PimCoumans committed Feb 24, 2023
1 parent d05c946 commit d10437e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/DidUpdate/ObservedValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ public struct ObservedValue<Value> {
storage storageKeyPath: ReferenceWritableKeyPath<EnclosingSelf, Self>
) -> ReadOnlyProxy<Value> {
get {
let storage = instance[keyPath: storageKeyPath]
return ReadOnlyProxy(
get: { storage.storage },
get: {
instance[keyPath: storageKeyPath].storage
},
updateHandler: { instance.addObserver(keyPath: storageKeyPath, handler: $0) }
)
}
Expand Down

0 comments on commit d10437e

Please sign in to comment.