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

Add toggle for enabling invisible scrollview (#1) #59

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions ScalingCarousel/Classes/ScalingCarouselView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ open class ScalingCarouselView: UICollectionView {
self.didScroll()
}
}

/*
This method should ALWAYS be called from the ScalingCarousel delegate when you want to
disable the invisible scroller.
*/
public func toggleInvisibleScrolling(_ toggle: Bool) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than a new function, we could add a didSet on the UIScrollView isScrollEnabled, and in it set the value of the invisible scrollviews isScrollEnabled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! That works also.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. I think it accomplishes two things:

  • It makes the intent clearer
  • It does not expose the invisible scroll view

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, did you wanted me to make these changes :)?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did. 👍🏽

self.invisibleScrollView.isScrollEnabled = toggle
}
}

private typealias PrivateAPI = ScalingCarouselView
Expand Down