fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.29k stars 172 forks source link

[FEAT] Multiple Page scroll based on drag spped #73

Closed AfshinHonari closed 4 years ago

AfshinHonari commented 4 years ago

Swipe multiple pages based on speed of drag

fermoya commented 4 years ago

Hi @ahs441 , I’m afraid if you don’t give me more information I won’t be able to help you and will have to close this issue

yyl0 commented 4 years ago

maybe @ahs441 meant being able to scroll more than one page depending on the strength of the swipe?

fermoya commented 4 years ago

Yeah that's what I assumed, but there's barely any information. I need to create a template to open issues...

I've released a very quick beta, 1.9.0-beta.1, use .multiplePagination(). I'll see if I can polish up a bit more in the next days. Can you give me some feedback, please? @yyl0 , @ahs441

Note: In order to scroll multiple pages, the content loading policy should be eager. Whenever you use the new modifier multiplePagination, Pager will be set to be eager. Setting it back to .lazy could turn out into a bad UX

yyl0 commented 4 years ago

it's pretty good when you swipe super fast! just tried it right now. each of my pages are video objects though, so swiping slowly (1 page at a time) is super jagged now

fermoya commented 4 years ago

@yyl0 can you record a video on your device/simulator so that I can see it, please?

AfshinHonari commented 4 years ago

Hi @ahs441 , I’m afraid if you don’t give me more information I won’t be able to help you and will have to close this issue

Based on @yyl0 explanation and your response i want a .multiplePagination() feature in the library; thanks for your response;

fermoya commented 4 years ago

@ahs441 I released a beta version yesterday, v1.9.0-beta.1. Can you give me some feedback please?

AfshinHonari commented 4 years ago

@fermoya Yes exactly but when i use preferredItemSize with size of too low such as 50*50, thats not work; it work only on item with full width size;

fermoya commented 4 years ago

@ahs441 , released v1.9.0-beta.2. Share here your thoughts, please

AfshinHonari commented 4 years ago

@fermoya awesome; thanks for your great support

AfshinHonari commented 4 years ago

@fermoya There is one more bug; when preferredItemSize is too low and the items count is limited for example there is only 5-6 items; when we scroll fast with .infiniteLoop() mode, item replacement has bad UX; this bug also visible when we drag pages with low speed without pickup our finger and reached end of items, when we pickup our finger items are replaced in the end of list;

fermoya commented 4 years ago

@ahs441 can you attach a video please? If you read the documentation about loopPages it says:

To have a nice experience, ensure that the data passed in the intializer has enough elements to fill enough pages on both the screen and the sides.

  • Note: You can try experimenting with the itemAspectRatio or the itemSpacing.

I think what you're experiencing is expected, but let me take at a screen recording when you attach it

AfshinHonari commented 4 years ago

@fermoya Sure i will take a video; can i send the video for your Email? i don't want to share any info about my app with other users; because it does not currently released

fermoya commented 4 years ago

@ahs441 sure you can! You can also download the example available in this repository and modify the values in one of the tabs to replicate the issue

AfshinHonari commented 4 years ago

@fermoya video has been Emailed to fmdr.ct@gmail.com; Thanks;

fermoya commented 4 years ago

Hi @ahs441 , I've released version 1.9.0-beta.3. I've added the possibility to repeat elements when calling loopPages. So if your array of items is too low, you can call loopPages(repeating:) to repeat the input and have this way more elements.

There isn't much to do here. I'll keep giving it a look and if it doesn't seem nice I'll just take the approach of not supporting multiple pagination for looping pagers and have it available only for regular pagers.

yyl0 commented 4 years ago

thanks for the support!! appreciate the fast response @fermoya 👍

fermoya commented 4 years ago

1.9.0 is live now

fermoya commented 4 years ago

@yyl0 , @ahs441 don't forget to star the repository if you like it 😊.

yyl0 commented 4 years ago

starred!