Should we be using CGFloat for all floating point numbers in Swift?
swift
Solution
According to Chris Lattner, they recognize this problem and will have an official solution soon. I'd wait until this solution is fixed before deciding whether or not to use CGFloat.
We're aware of this problem and consider it to be serious: we are evaluating several different solutions right now and will roll one out in a later beta. As you notice, you can cope with this today by casting to Double. This is inelegant but effective :-)
Problem
After watching a lot of the WWDC videos and reading through the Swift iBook, I came away with the impression that `CGFloat` was somewhat... legacy, due to the emphasis on `Int` and `Double/Float`. Perhaps somewhat comparable to `NSString` vs `String`. I wrote a bit of code with the latter, and `Double` won't compile on non-64 bit devices. `Int` seems fine, though. Should we still be using `CGFloat` for all math? Has anyone found anything that would indicate we'd be able to use the native Swift numerics? Because right now they're essentially unusable outside of scripts.