by billconan · 10y ago · 0 comments
I need to convert Int to In32 and CFloat to CGFloat a lot.
I wonder why there are so many basic types, and why can't they be simply converted to other types.
CGFloat, depending on the runtime, may either be a Float or a Double, so explicitly converting to and from it is required.
Rather than create a byzantine set of rules about whether it is "safe" to convert from one type to another, Swift wisely requires that all type conversions be explicit.