Open OscarFridh opened 5 years ago
I think I would either create an alternative delegate method:
@objc optional func didDragHorizontalToReorder(inRightDirection right: Bool, maxX: CGFloat, minX: CGFloat)
Or introduce enum:
@objc public enum DragDirection: Int {
case up, down, left, right
}
And use that in the delegate?
@objc optional func didDragToReorder(direction: APRedorderableStackView.DragDirection, max: CGFloat, min: CGFloat)
Good idea! I think I prefer the alternative delegate method because then the caller can check the direction on the boolean instead of switching over an enum. The stack view will be either horizontal or vertical so it's unnecessary to switch over four cases. Or what do you think?
Yeah that makes sense :)
Here's a new PR that strictly addresses adding horizontal support. I wasn't sure how you want to handle delegation in this case, so currently If the stack view is set up to be horizontal the delegate method (didDragToReorder) is called in the same way where 'up' represents right and 'Y' represents X.