Skip to content

Commit 0995aa9

Browse files
committed
Move the check for NSNumber just above the common types.
1 parent 1aff228 commit 0995aa9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Foundation/UserDefaults.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ open class UserDefaults: NSObject {
4040
return true
4141
}
4242

43-
let isOfCommonTypes = value is String || value is Data || value is Date || value is Int || value is Bool || value is CGFloat
44-
if isOfCommonTypes {
43+
// NSNumber doesn't quite bridge -- treat it specially.
44+
if value is NSNumber {
4545
return true
4646
}
4747

48-
// NSNumber doesn't quite bridge -- treat it specially.
49-
if value is NSNumber {
48+
let isOfCommonTypes = value is String || value is Data || value is Date || value is Int || value is Bool || value is CGFloat
49+
if isOfCommonTypes {
5050
return true
5151
}
5252

0 commit comments

Comments
 (0)