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
  • 314,917
  • 42
  • 532
  • 579
Bhanupriya
  • 1,202
  • 1
  • 9
  • 20

0 Answers0