How to restrict a UIDragItem to an axis

311 Views Asked by At

I have a UIImageView which I have made it draggable by adding it an UIDragInteraction as shown in the code below. Now, I can drag it in any direction, however, I want the draggable item to be restricted to the y-axix(verticle). i.e. no motion along the x-axis. How can I achieve that?

    let dragInteraction = UIDragInteraction(delegate: self)
    dragInteraction.isEnabled = true
    dragView.addInteraction(dragInteraction)
0

There are 0 best solutions below