ScalarArithmetic32/64 位数值转换
ScalarArithmetic 使用隐式转换进行更好的 32 位和 64 位的数值类型转换。
示例:
let myHeight = 34.5let myWidth = 100.23 let sizeOfWindow = CGSize(width:myWidth, height:myHeight) let myDouble:Double = sizeOfWindow.height // .height is a CGFloatlet isLargerThan = 213.3 > sizeOfWindow.width // 213.3 is a Double//You can now compare or do mathematical operations on the following: var doubleValue:Double = 5.0 var cgFloatValue:CGFloat = 5.0 var intValue:Int = 5 var int16Value:Int16 = 5 var int32Value:Int32 = 5 var int64Value:Int64 = 5 var uInt16Value:UInt16 = 5 var uInt32Value:UInt32 = 5 var uInt64Value:UInt64 = 5
评论