Conversion between CGFloat and NSNumber without unnecessary promotion to Double
问题 As we all know, CGFloat (which is ubiquitous in CoreGraphics, UIKit etc) can be a 32-bit or 64-bit floating point number, depending on the processor architecture. In C, CGFloat it is a typealias to float or double , in Swift is it defined as a struct CGFloat with a native property (which is Float or Double ). It has been observed repeatedly that a NSNumber can be created from and converted to Float and Double , but that there exist not similar conversions from and to CGFloat . The general