Orderella / PopupDialog

A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
http://www.mwfire.de
Other
3.95k stars 522 forks source link

Possibility to dismiss with gesture to top and bottom? #119

Closed ivnsch closed 7 years ago

ivnsch commented 7 years ago

I was looking for a way to be able to dismiss the (same) popup to top as well as bottom. A possible way to implement this would be to create a delegate for InteractiveTransition, which would be implemented by PresentationManager, in order to be notified if the current direction is to the top or to the bottom, so it can return a DismissInteractiveTransition with the respective direction. This would also require that vc.dismiss(animated: true, completion: nil), in InteractiveTransition would be called in .changed and not in .began like it's now, since it's necessary to get the first delta to determine the direction.

Questions: Is there interest for this feature? If yes, is this the correct way to implement it or is there maybe a better one?

mwfire commented 7 years ago

Hey @i-schuetz,

at the moment, this is not possible. I agree, though, that this might be a desired behavior. Feel free to do a PR on this, I do not have any approach in mind at the moment, tbh.

Thanks!

ivnsch commented 7 years ago

Hey. I ended modifying an own custom popup, so I'll probably not do this. Feel free to close, if you want!

ergunkocak commented 5 years ago

Commenting out lines: // if interactor.hasStarted || interactor.shouldFinish { // return DismissInteractiveTransition() // }

in "PopupDialog/Classes/PresentationManager.swift" Fixed the PanGestureDismiss direction for me.

ergunkocak commented 5 years ago

Also conversting 👍 let translation = sender.translation(in: vc.view) let verticalMovement = translation.y / vc.view.bounds.height let downwardMovement = fmaxf(Float(verticalMovement), 0.0) let downwardMovementPercent = fminf(downwardMovement, 1.0)

to let translation = sender.translation(in: vc.view) let verticalMovement = (-translation.y) / vc.view.bounds.height let downwardMovement = fmaxf(Float(verticalMovement), 0.0) let downwardMovementPercent = fminf(downwardMovement, 1.0)