marlimox / AloeStackView

A simple class for laying out a collection of views with a convenient API, while leveraging the power of Auto Layout.
Apache License 2.0
2.83k stars 170 forks source link

Add swipe gesture recognizer #31

Closed MikeGlotov closed 5 years ago

MikeGlotov commented 5 years ago

Hi,

I have a plan to use the framework in one of my projects, but I'd like to have an option to handle swipe gestures on "cells". That will allow to make a cell of an "image gallery" kind or something simillar.

I'd suggest adding a swipe recognizer to a StackViewCell class. I can do that and it seems to be relatively easy to do. The only thing to concern is the fact that right now I don't see an option to make a cell be both higlightable and swipable, mostly because of overriden touchesBegan, touchesEnded methods.

Would be glad to hear yout thoughts on that. Thank you.

colinhumber commented 5 years ago

AloeStackView has a cellForRow(_:) method that can be overridden by subclasses, allowing them to provide a custom StackViewCell class, which could add it's own gesture recognizer and override the touches... methods. That should work to provide a lot of customization behaviors.