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
You can get an integer representation of your float by passing the float into the Integer initializer method.
Example:
Int(myFloat)
Keep in mind, that any numbers after the decimal point will be loss. Meaning, 3.9 is an Int of 3 and 8.99999 is an integer of 8.