Skip to content

Commit

Permalink
Fix: Multiple .permanent instances keys are different when instantiat…
Browse files Browse the repository at this point in the history
…ed from different places. (#6)

#5
  • Loading branch information
iHugo-Tang authored Feb 12, 2023
1 parent 76e5d0d commit b9d6a63
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Sources/DefaultValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,14 @@ public final class DefaultValues {
let dependencyKey: DependencyKey?

func hash(into hasher: inout Hasher) {
hasher.combine(ObjectIdentifier(storageKeyPath))
hasher.combine(storageKeyPath)
if let dependencyKey {
hasher.combine(dependencyKey)
}
}

typealias ID = ObjectIdentifier
static func == (lhs: DefaultValues.StorageID, rhs: DefaultValues.StorageID) -> Bool {
let equalIDs = ID(lhs.storageKeyPath) == ID(rhs.storageKeyPath)
let equalIDs = lhs.storageKeyPath == rhs.storageKeyPath
switch (lhs.dependencyKey, rhs.dependencyKey) {
case (.none, .none): return equalIDs
case (.none, .some), (.some, .none): return false
Expand Down

0 comments on commit b9d6a63

Please sign in to comment.