Skip to content

Commit ce5469a

Browse files
committed
Fix a compile error on swift 5.4 or earlier
The error detail is here: > Extensions.swift:11:18: error: cannot convert value of type 'CGFloat' to > expected argument type 'Double' > > let v = (self * p).rounded(.towardZero) / p > ^ > Double( )
1 parent 93c31fd commit ce5469a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import UIKit
77
extension CGFloat {
88
/// Returns this value rounded to an logical pixel value by a display scale
99
func rounded(by displayScale: CGFloat) -> CGFloat {
10-
let p = 1.0e9
10+
let p = CGFloat(1.0e9)
1111
let v = (self * p).rounded(.towardZero) / p
1212
return (v * displayScale).rounded(.toNearestOrAwayFromZero) / displayScale
1313
}

0 commit comments

Comments
 (0)