SebastianBoldt / Jelly

🌊 - Jelly is a library for animated, non-interactive & interactive viewcontroller transitions and presentations with the focus on a simple and yet flexible API.
http://www.sebastianboldt.com/
MIT License
2.45k stars 121 forks source link

Edge drag available after dismiss called #61

Closed NirpE closed 5 years ago

NirpE commented 5 years ago

I am using following way to present my view controller:

let navController = UINavigationController(rootViewController: vc)

let interactionConfiguration = InteractionConfiguration(presentingViewController: self, dragMode: .edge)
let presentation = SlidePresentation(direction: .right, interactionConfiguration: interactionConfiguration)

self.animator = Animator(presentation: presentation)
self.animator?.prepare(presentedViewController: navController)
self.present(navController, animated: true)

It is working fine, sliding from right to left and edge drag is working too.

However after I call self.dismiss(animated: true) in the pushed VC I can still drag the VC back from right edge.

Is there a way to prevent that?

SebastianBoldt commented 5 years ago

The current Version of Jelly does not support this out of the Box. I will try to find a good solution for this and provide it to you in the next version. Users should be able to define which type of interaction direction needs be enabled (presentation or dismissal or both).

There is one solution possible at the moment which seems a little bit hacky but it should work. Just look for the right GestureRecognizer of your presentingView and disable it. I used an identifier internally which will be provided in the next release so users can access it from outside. Until then you need to use the naked string "JellyInteractivePanGestureRecognizer"

let identifier = "JellyInteractivePanGestureRecognizer"
let rec = view.gestureRecognizers?.first { $0.name == identifier }
recognizer?.isEnabled = false

Call this after you prepare

SebastianBoldt commented 5 years ago

@NirpE I already fixed this. Super easy ;).

You can specify an interactionMode (.presentation, .dismiss, .both) now, which will tell the interactionController which type of interaction should be enabled.

This will be available in the next release.

Maybe tomorrow or later this week because the new things should also be tested and documented. There is also a new parallax parameter available on slide presentations if you are interested :D

https://github.com/SebastianBoldt/Jelly/commit/be1dabeffae76b0cbea2ced8268056591ce55678

SebastianBoldt commented 5 years ago

I will close this Issue by myself if the fix is live.

SebastianBoldt commented 5 years ago

https://github.com/SebastianBoldt/Jelly/releases/tag/2.1.0