Can anyone tell me how to round a double value to x number of decimal places in Swift?
I have:
var totalWorkTimeInHours = (totalWorkTime/60/60)
In Swift 5.3 and Xcode 12:
let pi: Double = 3.14159265358979 String(format:"%.2f", pi)
Example:
PS.: It still the same since Swift 2.0 and Xcode 7.2