0

I have the following method that's working fine with Swift 2:

func roundToPlaces(_ places:Int) -> Double {
    let divisor = pow(10.0, Double(places))
    return round(self * divisor) / divisor
}

But it's not working with Swift 3. Someone please tell me its replacement in Swift 3.

rmaddy
  • 307,833
  • 40
  • 508
  • 550
Bhanupriya
  • 1,192
  • 1
  • 8
  • 19

0 Answers0