mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
9 lines
250 B
Swift
9 lines
250 B
Swift
|
|
extension CGFloat {
|
|
|
|
/// Round the number to the given amount of decimal places.
|
|
func rounded(toPlaces places:Int) -> CGFloat {
|
|
let divisor = pow(10.0, CGFloat(places))
|
|
return (self * divisor).rounded() / divisor
|
|
}
|
|
}
|