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

Tracking Scroll without swapping delegate #128

Closed
1 of 3 tasks
muukii opened this issue Feb 5, 2019 · 6 comments
Closed
1 of 3 tasks

Tracking Scroll without swapping delegate #128

muukii opened this issue Feb 5, 2019 · 6 comments

Comments

@muukii
Copy link

muukii commented Feb 5, 2019

Short description

When using ASCollectionNode of Texture (http://texturegroup.org/),
With FloatingPanelController.track(_ :), Texture raise an exception.

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ASCollectionView uses asyncDelegate, not UICollectionView's delegate property.'

Expected behavior

The current approach what swapping delegate is so good.
But, It may have some problem with to swap delegate.
So, We need to find another approach to track scroll in scrollview.

Or, as a workaround, To tell scroll event manually will be not bad.
If the customers have this problem, We tell them this workaround.

Actual behavior

Steps to reproduce

set scrollView of ASCollectionNode.view to track().
then an exception will be caused by Texture.

Code example that reproduces the issue

Environment

Library version

1.3.3

Installation method

  • CocoaPods
  • Carthage
  • Git submodules

iOS version(s)

iOS 12.1

Xcode version

10.1

@scenee
Copy link
Owner

scenee commented Feb 6, 2019

Thanks for your report, @muukii! I will consider a solution for each option.

@muukii
Copy link
Author

muukii commented Feb 10, 2019

@scenee

I've found out an idea.
Find UIScrollView from UIEvent with custom sub-class of UIPanGesture.
What do you think?

https://twitter.com/i/timeline

@scenee
Copy link
Owner

scenee commented Feb 19, 2019

I'm so sorry to be too late for my reply. I've been so busy recently.

At first, You idea is great 😎 I couldn't come up with it. Now the library adds a target to UIScrollView.panGestureRecognizer to control a scroll view. But even now it's not enough. I'm happy for you to try to improve the scroll tracking with the hack 😄

Then I'm going to talk about this issue. In conclusion, the hack doesn't seem to be working for the use case for which the library uses the swapping delegate. The use case is that a user can scroll seamlessly after a user moves a panel from .tip/.half to .full. Therefore, it has to control or prevent scroll deceleration after finger up.

It would be great for the library to allow a user to use Texture in a panel and it should be. So now I'm trying to replace swapping delegate by adding a display link to prevent scroll deceleration after finger up 👍

If you have any ideas, I'm happy for you to let me know!

@muukii
Copy link
Author

muukii commented Feb 23, 2019

@scenee

Thank you
I know what you think, and I may know what you want.
We have to control the deceleration of UIScrollView when moving the FloatingPanel.

I've also tried to find a way of solution for that.
and then, I've found a way of this.

https://github.com/muukii/Rideau/blob/dc7738eb5df15825cdc027cd2be172e1a025ce5c/Rideau/RideauInternalView.swift#L470

@scenee
Copy link
Owner

scenee commented Mar 4, 2019

Thank you for your mention! (I'm sorry to be late a bit) That's working 🎉
I tried to use UIScrollView.setContentOffset(_:animated:) before, but it was working because I didn't use it with DispatchQueue.main.async!

I created a draft PR #151 with remove-swapping-scroll-delegate branch. I'm pleased that you check it if you have time 😄

@scenee
Copy link
Owner

scenee commented Mar 26, 2019

@muukii
I merged remove-swapping-scroll-delegate branch to master. Thanks to you, I could remove swapping scroll delegate and make the control of a scroll deceleration well🎉 I appreciate it👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants