To cast an Int to a Float:
let someInt: Int = 3 let someFloat: CGFloat = CGFloat(someInt)
This is useful if you’d like to generate a random float:
let randomY = CGFloat(arc4random() % 1000) / 1000
To cast an Int to a Float:
let someInt: Int = 3 let someFloat: CGFloat = CGFloat(someInt)
This is useful if you’d like to generate a random float:
let randomY = CGFloat(arc4random() % 1000) / 1000