applidium / OverlayContainer

Non-intrusive iOS UI library to implement overlay based interfaces
https://gaetanzanella.github.io/2018-12-17/replicating-apple-maps-overlay
Other
1.15k stars 94 forks source link

didEndDraggingOverlay is called after a moveOverlay call #21

Closed joustava closed 5 years ago

joustava commented 5 years ago

This is not a bug and intentional I'd guess, but what do you think about separating 'dragging' and calling moveOverlay callbacks, e.g something similar to

func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
                                        didEndDraggingOverlay overlayViewController: UIViewController,
                                        transitionCoordinator: OverlayContainerTransitionCoordinator) {}

The above would be the original callback but only called when a user actually drags.

func overlayContainerViewController(_ containerViewController: OverlayContainerViewController,
                                        didEndMovingOverlay overlayViewController: UIViewController,
                                        transitionCoordinator: OverlayContainerTransitionCoordinator) {}

The above would be an additional callback but only called after moveOverlay call has finished?

Thoughts?

gaetanzanella commented 5 years ago

Hi @joustava, could you provide an use case of your proposal ?

joustava commented 5 years ago

I don't have a real use-case at the moment. I just noticed that didEndDraggingOverlay is called for when a user actually drags the overlay and also when I'd just trigger the moveOverlay from code. This last confused me a little as I wasn't expecting didEndDraggingOverlay to be called when a user doesn't drag and instead the moveOverlay would be called to e.g dismiss the overlay after tapping a button.

Might be I am slightly abusing this library, and what I am actually looking for is to check when the overlay is not shown at all, so that I can replace it's content when that happens.

gaetanzanella commented 5 years ago

I'm working on OverlayContainer 2.0. Showing/hiding the overlay should be easier, thanks to the method canReachNotchAt. Would you like to try it ?

gaetanzanella commented 5 years ago

https://github.com/applidium/ADOverlayContainer/tree/feature/overlayContainerV2

gaetanzanella commented 5 years ago

I released 2.0.0, try it directly 🙂

joustava commented 5 years ago

Just managed to update to 2.0. Works like a charm. Thanks!