Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typo scrollDrection -> scrollDirection #15

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading