posix88 / AMDragDrop

A UIView subclass that provide drag & drop functionality

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AMDragDrop

Version License Platform

Installation

AMDragDrop is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "AMDragDrop"

Description

AMDragDrop is a simple subclass for UIView that adds in a simple way the drag and drop funtionality.

In order to enable dragging on your view you have to call this:

dragView.enableDragging(dragDelegate: self, dropViews: [(dropView)])

with dropViews is an array of possible UIView in which you could drop your view.

The module expose two protocols you could subscribe to: AMDragDropDelegate and AMHoverDelegate.

AMDragDropDelegate

This is the protocol you have to subscribe to in order to have the basic information of the drag and drop funtionality.

The only mandatory method is:

func view(_ view: UIView, wasDroppedOnDrop drop: UIView!)

This method informs you that your dragged view was dropped on the drop views that you specified during the initialization.

If you're not interested in using drop views you could use:

func draggingEnd(forView view:UIView)

AMHoverDelegate

This is the protocol you have to subscribe to in order to have the basic information during the hovering of your view on the drop views that you specified during the initialization.

Author

Made with love ❤️ by Antonino Francesco Musolino. Twitter @Ninomusolino

License

This is a modified and "Swifty" version of UIView+DragDrop by ryanmeisters.

AMDragDrop is available under the MIT license. See the LICENSE file for more info.

About

A UIView subclass that provide drag & drop functionality

License:MIT License


Languages

Language:Swift 87.6%Language:Ruby 12.4%