Skip to content

Commit 877a052

Browse files
committed
Numeric types fail to properly convert via as? _NSObjectRepresentable on linux targets
This is a work-around to account for this failure case
1 parent c52bd91 commit 877a052

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Foundation/NSSwiftRuntime.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ internal func _NSObjectRepresentableBridge(value: Any) -> NSObject {
257257
return str._nsObjectRepresentation()
258258
} else if let obj = value as? NSObject {
259259
return obj
260+
} else if let obj = value as? Int {
261+
return obj._bridgeToObject()
262+
} else if let obj = value as? UInt {
263+
return obj._bridgeToObject()
264+
} else if let obj = value as? Float {
265+
return obj._bridgeToObject()
266+
} else if let obj = value as? Double {
267+
return obj._bridgeToObject()
268+
} else if let obj = value as? Bool {
269+
return obj._bridgeToObject()
260270
}
261271
fatalError("Unable to convert value of type \(value.dynamicType)")
262272
}

0 commit comments

Comments
 (0)