Skip to content

Commit

Permalink
Merge pull request cx-org#83 from cx-org/filter-in-place
Browse files Browse the repository at this point in the history
Clean up storage of ObservableObjectPublisherCache in place.
  • Loading branch information
ddddxxx authored Jun 18, 2020
2 parents 9ce154b + a502288 commit 1b97107
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/CombineX/Internal/ObserableObjectCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class ObservableObjectPublisherCache<Key: AnyObject, Value: AnyObject> {
private var lock = Lock()

private func cleanup() {
storage = storage.filter { key, value in
return key.value != nil && value.value != nil
for (key, value) in storage where key.value == nil || value.value == nil {
storage.removeValue(forKey: key)
}
}

Expand Down

0 comments on commit 1b97107

Please sign in to comment.