Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit b97073b

Browse files
committed
even round only if bigger than 1
1 parent a8acb6b commit b97073b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sources/Extensions.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ extension Array {
4242
extension CGFloat {
4343

4444
var evenRounded: CGFloat {
45+
guard self > 1 else {
46+
return self
47+
}
4548
var newValue = self.rounded(.towardZero)
4649
if newValue.truncatingRemainder(dividingBy: 2) == 1 {
4750
newValue -= 1

0 commit comments

Comments
 (0)