Esqarrouth / EZSwiftExtensions

:smirk: How Swift standard types and classes were supposed to work.
MIT License
3k stars 381 forks source link

'multiply(by:)' is unavailable: Please use operators instead. #478

Closed vshalvaghasiya closed 6 years ago

vshalvaghasiya commented 6 years ago

public func rounded(toPlaces places: Int) -> Self { guard places >= 0 else { return self } var divisor: Self = 1 for _ in 0..<places { divisor.multiply(by: 10) } return (self * divisor).rounded() / divisor }

screen shot 2018-06-12 at 1 01 49 pm