Mijick / NavigationView

Navigation made simple (SwiftUI)
MIT License
238 stars 9 forks source link

Gestures Support #31

Closed FulcrumOne closed 2 months ago

Nathan1258 commented 3 months ago

+1

devmlew commented 2 months ago

+1

FulcrumOne commented 2 months ago

FYI: I'm starting to work on it today

Nathan1258 commented 2 months ago

FYI: I'm starting to work on it today

Do you know of a timeframe for when this could potentially be out?

FulcrumOne commented 2 months ago

Hey @Nathan1258,

Next week, but it's hard to say on which day exactly, because I have some other tasks to do in parallel. Anyway, I'll do my best to have it finished by the 26th of June, as I initially planned, but no promises 😉

Have a great day, T.K.

FulcrumOne commented 2 months ago

Hey, I'm posting an update on the task here:

So the work is moving forward, and you can see the initial results here: https://github.com/Mijick/NavigationView/assets/23524947/161bb4d1-b5ee-414c-a684-5998f63110a7

As you can see, it works, but unfortunately I detected a few bugs during the process. Besides, the final version will also support the pinch gesture (dedicated to the "scale" transition), hence some delays are expected (but still finishing it by the end of the week is in my plan).

I hope to clarify a little more about our schedule tomorrow!

Nathan1258 commented 2 months ago

Hey, I'm posting an update on the task here:

So the work is moving forward, and you can see the initial results here:

https://github.com/Mijick/NavigationView/assets/23524947/161bb4d1-b5ee-414c-a684-5998f63110a7

As you can see, it works, but unfortunately I detected a few bugs during the process. Besides, the final version will also support the pinch gesture (dedicated to the "scale" transition), hence some delays are expected (but still finishing it by the end of the week is in my plan).

I hope to clarify a little more about our schedule tomorrow!

Looks great! Thanks for adding this feature so quickly! Looking forward for the final version.

FulcrumOne commented 2 months ago

Hey guys,

The feature has been implemented in the patch-1.1.0 branch. Could you please test it and tell me if you noticed any bugs? Thanks for your support! ;)

Nathan1258 commented 2 months ago

Hey guys,

The feature has been implemented in the patch-1.1.0 branch. Could you please test it and tell me if you noticed any bugs? Thanks for your support! ;)

Hi,

Thanks for implementing this so quickly, should the gesture support to navigate back to the previous page 'just work' like do we have to configure this on our views for it to work? Just installed the branch and couldn't get my views to navigate back - took a look at the source code and couldn't find anything that I would have to do within my app to enable this function?

lutianlei commented 2 months ago

@Nathan1258 func configure(view: NavigationConfig) -> NavigationConfig { view.navigationBackGesture(.drag) }

Nathan1258 commented 2 months ago

@Nathan1258 func configure(view: NavigationConfig) -> NavigationConfig { view.navigationBackGesture(.drag) }

Just saw in the source code as soon as you added this comment 🤣 - thank you!

Nathan1258 commented 2 months ago

@FulcrumOne Works great!

lutianlei commented 2 months ago

https://github.com/Mijick/NavigationView/assets/14904536/4bd9b230-1fe6-4634-905f-093d655ad1d4

@FulcrumOne Looks like something's wrong

FulcrumOne commented 2 months ago

79_1719564270.mp4

@FulcrumOne Looks like something's wrong

Thanks, I'm looking into it

FulcrumOne commented 2 months ago

@lutianlei,

I'm trying to replicate this in my app, but so far with no results; to clarify, you started scrolling down the scroll view and at the same time tried to use the gesture to return to the previous view, correct?

Does this bug occurs all the time?

Nathan1258 commented 2 months ago

@lutianlei,

I'm trying to replicate this in my app, but so far with no results; to clarify, you started scrolling down the scroll view and at the same time tried to use the gesture to return to the previous view, correct?

Does this bug occurs all the time?

I too cannot replicate this in my own app, I can scroll and then go to swipe back to the previous page and it works well.

However, I'd love for it to only allow the user to swipe back to the previous view only when they start the swipe from the far left of their screen (which is how the norma NavigationStack works). Currently, the user is able to go back to the previous page if the user swipes left anywhere within the view.

lutianlei commented 2 months ago

I too cannot replicate this in my own app, I can scroll and then go to swipe back to the previous page and it works well.

However, I'd love for it to only allow the user to swipe back to the previous view only when they start the swipe from the far left of their screen (which is how the norma NavigationStack works). Currently, the user is able to go back to the previous page if the user swipes left anywhere within the view.

The two pages I tested where this happened, and it happened a lot, were List and ScrollView, and the action: swipe right very quickly

FulcrumOne commented 2 months ago

@lutianlei, I'm trying to replicate this in my app, but so far with no results; to clarify, you started scrolling down the scroll view and at the same time tried to use the gesture to return to the previous view, correct? Does this bug occurs all the time?

I too cannot replicate this in my own app, I can scroll and then go to swipe back to the previous page and it works well.

However, I'd love for it to only allow the user to swipe back to the previous view only when they start the swipe from the far left of their screen (which is how the norma NavigationStack works). Currently, the user is able to go back to the previous page if the user swipes left anywhere within the view.

@Nathan1258, OMG, you are damn right. I don't know why I didn't think of that before 😅 I'll implement it later today, thanks!

FulcrumOne commented 2 months ago

@Nathan1258, the branch named "patch-1.1.1" contains the feature you asked for. To make it work, use the NavigationGlobalConfig modifier; I have also added the backGestureThreshold attribute.

@lutianlei, could you please test the mentioned branch and tell me if the problem is still there? Thanks!

Nathan1258 commented 2 months ago

@FulcrumOne Yep, just tested and works great! Will revert back to the stable branch and implement into my apps once published!