Answers for "convert double to float swift"

1

Decimal to Double conversion in Swift

let someDouble = Double(truncating: someDecimal as NSNumber)
Posted by: Guest on March-25-2020
1

how do i get a string from a float swift to 1 decimal swift

let someFloat: Float = 3.14159
let floatToString: String = String(format: "%.01f", someFloat)
// floatToString => 3.14
Posted by: Guest on September-28-2020

Code answers related to "convert double to float swift"

Code answers related to "Swift"

Browse Popular Code Answers by Language