Jtapplecalendar: scrollingMode nonStopToSection(withResistance: CGFloat) skipping section

Created on 18 Nov 2017  路  43Comments  路  Source: patchthecode/JTAppleCalendar

  1. PLEASE STATE THE VERSION NUMBER you are using.
    7.1.4
  2. Are you using the latest version of JTAppleCalendar?
    Yes
  3. PROVIDE ENOUGH INFORMATION SO I CAN RECREATE THE PROBLEM.
    I have a vertical scrolling calendar setup with nonStopToSection as scrollingMode. The issue I see is that not always stop on the next section (month), sometimes it skips a month and I have to try multiple times to get it stop, even give just the right amount of inertia to get it in the month I want to eventually stop.

I'm not able to repro on 7.0.6. I jumped from that version to the latest one in which I observe the issue.
https://github.com/patchthecode/JTAppleCalendar/compare/7.0.6...7.1.4

vertical_scrolling_issue

Already Fixed on Master Branch bug

Most helpful comment

I have fixed all the other bugs, and the library is now very stable.
I will start working on this in a bit.

All 43 comments

Will check it out this afternoon.

.nonStopToSection(withResistance: ??)

I checked on my sample app on github and its working well.
What did you have as the resistance ?

Thanks @patchthecode

.nonStopToSection(withResistance: 0)

this is how I'm using it: https://gist.github.com/mgurreta/f20a540f56bb956d460bceda8b825e1f
(I slightly edited colors and font so you can import it. Well... you will need EasyPeasy, SwiftDate and RxSwift, or simply drop these dependencies by getting rid of the code using them)

The view controller is part of an UINavigationController on a UITabBarController.

Hello @patchthecode, no clue right?? :(

I could figure it out yet.

Are you available now? Join me here -> https://gitter.im/patchthecode/JTAppleCalendar

It could not reproduce it.
Is it possible you can give me an empty sample project with the issue?
I tried with my sample project, but every thing looks ok.
Or you can join me on that chat link above, and we can explain further.

@patchthecode can't join right now. But I'll put together an empty project for you.
I'll do it this afternoon. In an hour or two

@patchthecode here it is the sample app I created, the issue is reproducible there https://github.com/mgurreta/sample-JTAppleCalendar

OK i think i was able to replicate it.
To replicate it I had to scroll, and then while it is still scrolling i had to tap and hold with my finger, then scroll and release. (Im not sure if this is the same steps you used to experience it).

I know where to fix it. But I dont have the time now. I'll take a look at it probably on Monday.
The function in the library that handles scrolling action is scrollViewWillEndDragging located in the UIScrollViewDelegates.swift file.

I'll take a look around Monday God's willing.

@patchthecode Nice. Yes, absolutely.. that is the way I repro it.

Nice that you already know where to start looking for this bug... Not sure if I will be able to provide a fix, I'm also without much time to spare.

Anyways, will see. Hopefully we can make it happen.

Thanks

Hello @patchthecode !! did you get a chance to look into this issue?

Thanks in advance

Sorry man. I got very tied up. You'll have an update on this after work today. deadlines.

take it easy man!! :)

ok checking this out today

nice! any luck? @patchthecode

Im in the process on re-coding the scrolling now.
Its a stupid bug, based on one bad logic.
Rather than just putting in a patch, i decided to recode that function.

hahaha you're awesome man! let me know when you think it is ready and I can give it a try...

yea, i'll keep you posted.

@mgurreta my code is very incomplete.
but can you let me know if master branch behaves like how you want?

@patchthecode on it... give me 30mins to build master and run some test

alright. If it behaves like what you want, then i will totally rewrite that function. I think that was the last code clean I had to do for this library.

I'm working on another screen, so if you need to message quickly, then send here so that i get a notification. -> https://gitter.im/patchthecode/JTAppleCalendar

@patchthecode ok... so I build commit 4d5d9eb6bca96e9dc029171882060e8be946a373 using carthage,
I'm seeing debug print statements so we are good...

theTargetContentOffset = 2540.0
contentOffset = 2691.66666666667
theTargetContentOffset = 0.0
contentOffset = 2249.66666666667
theTargetContentOffset = 0.0
contentOffset = 115.666666666667

So... I'm not able to repro de reported bag anymore... but the scroll is not snapping to a section when I tap and release while scrolling. Instead, it completely stops the scroll leaving the calendar, sometimes, in the middle of 2 months. Which is not that bad, but I would expect that while releasing the tap the calendar will accommodate itself to the corresponding month.

i.e. If the user taps during scroll, the calendar stops but when it releases the tap I believe the calendar should animate and snap to the closest month. Hopefully I made myself clear.

@patchthecode I was thinking and actually avoiding the snapping when the user taps the screen it is cool... The thing is that with this scroll mode if you DON'T tap the screen, then when the inertia completely decelerate the frame finally snap to a section (month).. so we should make this behavior consistent. Snap in all cases or avoid sapping at all.

  • from API perspective, like we discussed Yesterday, nonStopToSection I would expect the frame to snap, always, maybe add another scrollingMode ??
  • maybe I'm getting wrong the entire thing and nonStopToSection mean do not stop/snap to section... in this case maybe another scrollingMode for the snap version, like nonStopSnapToSection??
  • too much confusion... you are the owner. Make the call! :) 馃

Whatever decision you take will be ok... but I really think that the behavior should be consistent.

What do you think?

After thinking about it
for consistency, i'll make it snap like it did before.
You're right when you say it may become too complex with nonStopSnapToSection.

The library has been flexible enough to meet many people's needs up till this point, so I think the behavoir should stay the same until someone has some use-case for another mode.

Thanks for the input dude.
Will get to work on this is a bit (maybe tomorrow). Hurrying up some code on the other project. I am free-er this week as my main project is semi-done.

No man... Thanks youuu!!

Whatever your understanding of nonStopToSection will be ok. The no snapping option is good though, I was using the App with the latest code from master and feels good!!

Your call! :)

please ping me if you need assistance, I'll try to connect to gitter.

Hey @patchthecode long time no talk!! How are you doing? Hopefully everything is going well!

I pinging you to see if you had chance to look into this bug any further?

Thanks man!

I know its bad man. But its going slowly. Trying to make a hard deadline for monday coming. Thats why im answering simple questions for now.
What I think i'll do is just make a patch on master branch for you only (instead of doing to major fix for all). That way you can continue with your work. After i am free-er, i can come back to it and clean up the code for everyone else.

But this means you'll have to use master branch for your project if youre ok with that.

Hey man! I completely understand and you don't need to worry about.

I'm already working on the master branch, so you don't really need to do any patch... what it's already on the master is enough for now and don't block me. We can talk again next week.

Good luck with your project! hopefully, you can make it for Monday! 馃弲

Hello @patchthecode ! happy new year!!! 馃嵕

Wondering if you had a chance to take a look at this issue?

Thanks!

I had to release the new version to stop some other bugs.
So i did.
In regards to the scrolling issue, i have moved the fixing over to this branch -> https://github.com/patchthecode/JTAppleCalendar/tree/FixingScrolls

This fix will come with a minor version bump.
One signature will be changed. (it's supposed to be a major version change, but im hoping the developers will forgive me). I didn't want to do a major change for such a small change, even though it is breaking one code line.

Completed scrollmodes are the following. Others are being added as i compete them. Then will release.

  • [x] .nonStopToSection
  • [x] .none
  • [ ] .nonStopToCell
  • [ ] .nonStopToCustomInterval
  • [ ] .stopAtEachCustomInterval
  • [ ] .stopAtEachSection
  • [ ] .stopAtEachCalendarFrame

so you are thinking to avoid jumping to 7.2.0? (and hotfix this?)

I guess devs will understand a one-liner change... if they are still in dev and not stick to a specific version.

@mgurreta

I guess devs will understand a one-liner change

haha i hope the can forgive me.. Im thinking of jumping to 7.2.0 instead of 8.0.0
I'll complete .nonStopToCell tonight.

Hello @patchthecode ! how are you doing man??

just touching base on this issue.

thanks

Hello @patchthecode! hope you are doing great... Do you have any update on this bug?

I'm still using the FixingScrolls branch with quite nice success for my use case!

Thanks,

for now, im just doing small updates.
keep using the branch. I have not forgotten about it.

Its just that your update is very large. The updates i have done on master branch thus far are just minor bug fixes. They will be ported over to that branch.
Eventually, when i get a good free week straight, i will just fix your once and for all.

Your fix will affect many users, so i've just been delaying. But you are not forgotten man.
Ideally, I do wish that someone who has more time than i do would just do a pull request. But if no one works on it, i will at some point.

Thanks, my friend! Absolutely, I'm ok using the FixingScrolls branch.

Unfortunately, I don't have to much time to work on it. Will see in the future...

In the meantime, I'll probably send you a PR with a merge brack from master into FixingScrolls.

Thanks man! 馃殌

I have fixed all the other bugs, and the library is now very stable.
I will start working on this in a bit.

awesome @patchthecode!!

reposting here.

Completed scrollmodes are the following. Others are being added as i compete them. Then will release.

  • [x] .nonStopToSection
  • [x] .none
  • [x] .nonStopToCell
  • [x] .nonStopToCustomInterval
  • [x] .stopAtEachCustomInterval
  • [x] .stopAtEachSection
  • [x] .stopAtEachCalendarFrame

Restarted code.

hey, i have finished the update.
Can you test to see if it fits your use cases? If all is well i will merge with master branch.

To test follow instructions here. BUT change the branch name to fixingScrolls2. Remember to clear cache etc as said in the instructions.

Let me know of any new/old issues bugs etc.

I couldnt wait :D

I merged with master branch.
closing this issue.
But PLEASE do let me know if you see any bug .

Will do @patchthecode !

Thanks,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fatalution picture Fatalution  路  3Comments

dbmrq picture dbmrq  路  5Comments

sahirmemon picture sahirmemon  路  4Comments

nikolalukovic picture nikolalukovic  路  4Comments

MoridinBG picture MoridinBG  路  5Comments