Ubuntu Linux 上的纯 Swift 中的数字类型不会自动桥接到 NSNumber?
Numeric types don't automatically bridge to NSNumber in pure Swift on Ubuntu Linux?
在 MacOS 上,如果您这样做:
import Foundation
let x = Int32(1) as? NSNumber
x 不为零。
在 Ubuntu Linux 上,如果你这样做(即使使用 Swift 3.1.1),x 为零。
我是不是做错了什么,或者这仅仅是因为 Ubuntu/Linux 上的 Swift 没有将数值类型桥接到 NSNumber 上?
Linux 上没有自动桥接到 NSNumber
。资源:
NSNumber bridging and Numeric types:
Considerations for Linux platforms
We do not have bridging on Linux so the as?
cast is less important; but if it were to have bridging this would be the desired functionality.
在 MacOS 上,如果您这样做:
import Foundation
let x = Int32(1) as? NSNumber
x 不为零。
在 Ubuntu Linux 上,如果你这样做(即使使用 Swift 3.1.1),x 为零。
我是不是做错了什么,或者这仅仅是因为 Ubuntu/Linux 上的 Swift 没有将数值类型桥接到 NSNumber 上?
Linux 上没有自动桥接到 NSNumber
。资源:
NSNumber bridging and Numeric types:
Considerations for Linux platforms
We do not have bridging on Linux so the
as?
cast is less important; but if it were to have bridging this would be the desired functionality.