Skip to content

Commit b488e6c

Browse files
Kai AldagKai Aldag
Kai Aldag
authored and
Kai Aldag
committed
Implemented isEqualToDictionary
1 parent f699c8d commit b488e6c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Foundation/NSDictionary.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,19 @@ public class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCodin
278278
public func descriptionWithLocale(locale: AnyObject?, indent level: Int) -> String { NSUnimplemented() }
279279

280280
public func isEqualToDictionary(otherDictionary: [NSObject : AnyObject]) -> Bool {
281-
NSUnimplemented()
281+
if count != otherDictionary.count {
282+
return false
283+
}
284+
285+
for (key, value) in _storage {
286+
if otherDictionary[key] == nil {
287+
return false
288+
} else if otherDictionary[key] != value {
289+
return false
290+
}
291+
}
292+
293+
return true
282294
}
283295

284296
public struct Generator : GeneratorType {

0 commit comments

Comments
 (0)