Float data type has a built-in constructor that can convert from integers with no extra work from you. For example, to convert the integer 556 into its
Float equivalent, you'd use this:
let myInt = 556 let myFloat = Float(myInt)
Available from iOS 7.0
Did this solution work for you? Please pass it on!
Other people are reading…
About the Swift Knowledge Base
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Want to build macOS apps?
Hacking with macOS delivers 18 awesome projects that teach you macOS development in no time – take control of your desktop today!