Skip to content

Commit

Permalink
Merge pull request #15 from daangn/bug/david/fix-type
Browse files Browse the repository at this point in the history
fix typo scrollDrection -> scrollDirection
  • Loading branch information
GeekTree0101 authored May 13, 2024
2 parents f02d599 + 6652f6e commit 917f39a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Sources/SushiBelt/SushiBeltTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extension SushiBeltTracker {
guard let currentVisibleRatio = self.visibleRatioCalculator.visibleRatio(
item: item,
trackingRect: trackingRect,
scrollDirection: self.scrollDrection()
scrollDirection: self.scrollDirection()
) else {
return
}
Expand All @@ -106,15 +106,15 @@ extension SushiBeltTracker {
}
}

internal func scrollDrection() -> SushiBeltTrackerScrollDirection? {
internal func scrollDirection() -> SushiBeltTrackerScrollDirection? {
guard let scrollContext = self.scrollContext else {
assertionFailure("scrollContext must not be null")
return nil
}

if let scrollDrection = scrollContext.scrollDrection() {
if let scrollDirection = scrollContext.scrollDirection() {
// unsupported diagonal scroll tracking
return scrollDrection == .diagonal ? nil : scrollDrection
return scrollDirection == .diagonal ? nil : scrollDirection
} else {
return self.recentScrollDirection ?? self.defaultScrollDirection
}
Expand All @@ -126,7 +126,7 @@ extension SushiBeltTracker {
extension SushiBeltTracker {

private func cachingRecentScrollDirectionIfNeeded() {
guard let scrollDirection = self.scrollDrection() else { return }
guard let scrollDirection = self.scrollDirection() else { return }
self.recentScrollDirection = scrollDirection
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/SushiBelt/SushiBeltTrackerScrollContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public typealias PlatformScrollView = NSScrollView
#endif

public protocol SushiBeltTrackerScrollContext: AnyObject {
func scrollDrection() -> SushiBeltTrackerScrollDirection?
func scrollDirection() -> SushiBeltTrackerScrollDirection?
}

public final class SushiBeltTrackerUIScrollContext: SushiBeltTrackerScrollContext {
Expand All @@ -32,7 +32,7 @@ public final class SushiBeltTrackerUIScrollContext: SushiBeltTrackerScrollContex
self.scrollView = scrollView
}

public func scrollDrection() -> SushiBeltTrackerScrollDirection? {
public func scrollDirection() -> SushiBeltTrackerScrollDirection? {
guard let scrollView = self.scrollView else {
return nil
}
Expand Down
14 changes: 7 additions & 7 deletions Tests/SushiBeltTests/SushiBeltTrackerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .zero

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertEqual(direction, .left)
Expand All @@ -62,7 +62,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .zero

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertEqual(direction, .right)
Expand All @@ -75,7 +75,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .init(x: 0.0, y: -100.0)

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertEqual(direction, .up)
Expand All @@ -88,7 +88,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .init(x: 0.0, y: 100.0)

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertEqual(direction, .down)
Expand All @@ -101,7 +101,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .init(x: 100.0, y: 0.0)

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertEqual(direction, .left)
Expand All @@ -114,7 +114,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .init(x: -100.0, y: 0.0)

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertEqual(direction, .right)
Expand All @@ -127,7 +127,7 @@ extension SushiBeltTrackerTests {
self.panGestureRecognizer.velocityStub = .init(x: 100.0, y: 100.0)

// when
let direction = tracker.scrollDrection()
let direction = tracker.scrollDirection()

// then
XCTAssertNil(direction)
Expand Down

0 comments on commit 917f39a

Please sign in to comment.