How to convert float to an Int and Int to float?(Swift 3)
1 min readApr 30, 2018
If you want to convert your float value to an int (back and forth),
Follow the below code.
1. float To Int
let yourFloat = 22.7895let myIntValue = Int(yourFloat)print(myIntValue)output:- 22
2. Int to float
let someInt: Int = 3let someFloat: CGFloat = CGFloat(someInt)print(someFloat)output:- 3.0
Click Here:- Have a look on Sting to Int and Int to String Conversion