Consider the following function
CGSize CGSizeIntegral(CGSize size)
{
return CGSizeMake(ceilf(size.width), ceilf(size.height));
}
CGSi
For Swift, and neglecting the OP's specific question involving CGFloats, etc., the following may be more swiftish:
#if (arch(i386) || arch(arm))
.... // For 32-bit systems
#else
.... // For 64-bit systems
#endif
#if (arch(x86_64) || arch(arm64))
.... // For 64-bit systems
#endif
On the other hand, the compile-time constants discussed in the above answer are also available in Swift, if they are preferred.
This is mostly copied from here: https://stackoverflow.com/a/24869607/253938
And the Apple docs about these Swift compile-time constants is here: https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html (at the very bottom of the page).