fermoya / SwiftUIPager

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

feature: direct gesture translation while dragging #187

Closed nylki closed 3 years ago

nylki commented 3 years ago

This PR implements a new optional modifier animatesPositionWhileDragging whose default value is true. The default value retains the current behaviour, so it shouldn't have any impact for users updating to a version including this PR.

If animatesPositionWhileDraggingis set to false, the positions of the dragging gesture won't be animated/transitioned, resulting in a 1:1 tracking of finger to pager translation, like a ScrollView.

This targets and should resolve concerns raised in #157.

I made sure to add a short entry in the documentation. This could be expanded, to explain when you would want to set it (eg. if you prefer ScrollView like translation while dragging).

fermoya commented 3 years ago

Hi @nylki thanks for your contribution. By the time Issue 157 was opened I had my concerns because of state management at the time. Things have changed and version 2.0.0 introduced some changes.

I think I'd prefer if there was no modifier at all and you just removed the withAnimation block. I'll give it another look then and release a patch version

fermoya commented 3 years ago

Can we squash the commits into just one, please? See Squashing commits section here

nylki commented 3 years ago

Can we squash the commits into just one, please? See Squashing commits section here

I agree! Sorry for the mess. I'll just create a new PR with a clean branch.

nylki commented 3 years ago

@fermoya This is the fresh PR: #188 Let me know if you need additional changes.