LeoNatan / LNPopupController

A framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
MIT License
3.04k stars 342 forks source link

Set to pull down a longer distance to close Popup? #473

Closed CivelXu closed 3 years ago

CivelXu commented 3 years ago

Now when you go to pull down a little bit, popup put it away。 I want to set a longer distance to reduce the agility of the drop-down popoup.

LeoNatan commented 3 years ago

Hello, Use the .drag interaction style. https://github.com/LeoNatan/LNPopupController/blob/f1d3b02d1aaa5b7990beceb3691b8aea05e64846/LNPopupController/LNPopupController/UIViewController%2BLNPopupSupport.h#L35

LeoNatan commented 3 years ago

Depending on how difficult this turns out to be (I haven't touched that part of the code in years), I might add a delegate method or a property to control this.

LeoNatan commented 3 years ago

Implemented. Use popupInteractionStyle = .customizedSnap(percent: 0.6) to control the percent of drag before the popup is closed.

CivelXu commented 3 years ago

I use the .drag interaction style in my app. But the gesture is very easy to touch by mistake to close the popup.I can show you a video.

https://user-images.githubusercontent.com/19768199/128636124-aa5ff9ea-5eff-4097-85b9-48571141fcf2.mov

LeoNatan commented 3 years ago

That was the behavior of the popup in Apple's apps, before they switched to the snap behavior. I got it to behave very similarly. Basically, if you stop your gesture at the direction of dismiss, it dismisses. You can look at the internal logic for that. I haven't touched it in years because it was very close to Apple's behavior.