I want to convert a Float to an Int in Swift. Basic casting like this does not work because these types are not primitives, unlike float
Float
Int
float
Like this:
var float:Float = 2.2 // 2.2 var integer:Int = Int(float) // 2 .. will always round down. 3.9 will be 3 var anotherFloat: Float = Float(integer) // 2.0