Skip to content

Commit 992bb9e

Browse files
andriydrukAnton Pogonets
authored andcommitted
Dev: fix NSError isEqual
1 parent 0c7d339 commit 992bb9e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Foundation/NSError.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,12 @@ open class NSError : NSObject, NSCopying, NSSecureCoding, NSCoding {
170170
override open func isEqual(_ object: Any?) -> Bool {
171171
// Pulled from NSObject itself; this works on all platforms.
172172
guard let obj = object as? NSError else { return false }
173-
return obj === self
173+
if obj === self {
174+
return true
175+
}
176+
return obj.domain == self.domain
177+
&& obj.code == self.code
178+
&& NSDictionary(dictionary: obj.userInfo).isEqual(NSDictionary(dictionary: self.userInfo))
174179
}
175180
}
176181

0 commit comments

Comments
 (0)