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.