I was trying to do something like this
var myCGFloat: CGFloat = 3.001
ceilf(myCGFloat)
but ceilf
only takes Float
values. While searching around there were lots of different answers about doing this conversion or that depending on whether it is 32 or 64 bit architecture.
It turns out the solution is fairly easy but it took me too long to find it. So I am writing this Q&A pair as a shortcut for others.