Skip to content

Commit

Permalink
Apply swift format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vospennikov committed May 1, 2024
1 parent 3fb863a commit f3e60a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Example/Example-AppKit/App/Map/MapViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ final class MapViewDelegate: NSObject, MKMapViewDelegate {
func mapView(_ mapView: MKMapView, didAdd views: [MKAnnotationView]) {
NSAnimationContext.runAnimationGroup { context in
context.duration = 0.3
views.forEach { view in
for view in views {
view.animator().alphaValue = 1.0
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ final class ClusteredMapViewDelegate: NSObject, MKMapViewDelegate {
UIView.animate(
withDuration: 0.35, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: [],
animations: {
views.forEach { view in
for view in views {
view.alpha = 1
}
},
Expand Down
10 changes: 5 additions & 5 deletions Sources/ClusterMap/Internal/Extensions/FloatingPoint+Equal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ extension FloatingPoint {
if self == value {
return true
}

let absA = abs(self)
let absB = abs(value)
let diff = abs(self - value)

if self == .zero || value == .zero || (absA + absB) < .leastNormalMagnitude {
return isDiffLessThanUlp(diff)
} else {
return isDiffSmallEnough(diff, absA, absB)
}
}

private func isDiffLessThanUlp(_ diff: Self) -> Bool {
return diff < .ulpOfOne * .leastNormalMagnitude
diff < .ulpOfOne * .leastNormalMagnitude
}

private func isDiffSmallEnough(_ diff: Self, _ absA: Self, _ absB: Self) -> Bool {
let sumMin = min(absA + absB, .greatestFiniteMagnitude)
return diff / sumMin < .ulpOfOne
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ extension MKMapRect {
latitude: max(region.center.latitude - (region.span.latitudeDelta / 2), -90),
longitude: region.center.longitude + (region.span.longitudeDelta / 2)
)

if topLeft.longitude < -180 || bottomRight.longitude > 180 {
let world = MKMapRect.world

if topLeft.longitude < -180 {
topLeft.longitude += 360
}
Expand All @@ -49,11 +49,11 @@ extension MKMapRect {
width: (world.maxX - max(topLeftPoint.x, bottomRightPoint.x)) + min(topLeftPoint.x, bottomRightPoint.x),
height: world.height
)

} else {
let topLeftPoint = MKMapPoint(topLeft)
let bottomRightPoint = MKMapPoint(bottomRight)

self.init(
x: min(topLeftPoint.x, bottomRightPoint.x),
y: min(topLeftPoint.y, bottomRightPoint.y),
Expand Down

0 comments on commit f3e60a7

Please sign in to comment.