@@ -41,17 +41,12 @@ extension Dictionary : _ObjectTypeBridgeable {
41
41
42
42
if x. dynamicType == NSDictionary . self || x. dynamicType == NSMutableDictionary . self {
43
43
x. enumerateKeysAndObjectsUsingBlock { key, value, stop in
44
- if let k = key as? Key {
45
- if let v = value as? Value {
46
- dict [ k] = v
47
- } else {
48
- failedConversion = true
49
- stop. pointee = true
50
- }
51
- } else {
44
+ guard let key = key as? Key , let value = value as? Value else {
52
45
failedConversion = true
53
46
stop. pointee = true
47
+ return
54
48
}
49
+ dict [ key] = value
55
50
}
56
51
} else if x. dynamicType == _NSCFDictionary. self {
57
52
let cf = x. _cfObject
@@ -65,17 +60,11 @@ extension Dictionary : _ObjectTypeBridgeable {
65
60
for idx in 0 ..< cnt {
66
61
let key = unsafeBitCast ( keys. advanced ( by: idx) . pointee!, to: AnyObject . self)
67
62
let value = unsafeBitCast ( values. advanced ( by: idx) . pointee!, to: AnyObject . self)
68
- if let k = key as? Key {
69
- if let v = value as? Value {
70
- dict [ k] = v
71
- } else {
72
- failedConversion = true
73
- break
74
- }
75
- } else {
63
+ guard let k = key as? Key , let v = value as? Value else {
76
64
failedConversion = true
77
65
break
78
66
}
67
+ dict [ k] = v
79
68
}
80
69
keys. deinitialize ( count: cnt)
81
70
values. deinitialize ( count: cnt)
@@ -255,10 +244,9 @@ public class NSDictionary : NSObject, NSCopying, NSMutableCopying, NSSecureCodin
255
244
}
256
245
257
246
public override func isEqual( _ object: AnyObject ? ) -> Bool {
258
- guard let otherObject = object where otherObject is NSDictionary else {
247
+ guard let otherDictionary = object as? NSDictionary else {
259
248
return false
260
249
}
261
- let otherDictionary = otherObject as! NSDictionary
262
250
return self . isEqualToDictionary ( otherDictionary. bridge ( ) )
263
251
}
264
252
0 commit comments