I\'m trying to cut an image into 9 pieces in Swift. I\'m getting this error:
\'CGFloat\' is not convertible to \'Double\'
In swift there is no implicit conversion of numeric data types, and you are mixing integers and floats.
You have to explicitly convert the indexes to CGFloat
s:
var intWidth = ( CGFloat(i) * (sizeOfImage.width/3.0))
var fltHeight = ( CGFloat(j) * (sizeOfImage.height/3.0))
As often happening in swift, the error message is misleading - it says:
'CGFloat' is not convertible to 'Double'
whereas I'd expect:
'CGFloat' is not convertible to 'Int'