To run the example project, clone the repo, and run pod install
from the Example directory first.
HHDraggableView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'HHDraggableView'
HHDraggableView
can be installed using Swift Package Manager.
-
In Xcode open File/Swift Packages/Add Package Dependency... menu.
-
Copy and paste the package URL:
https://github.com/shamzahasan88/HHDraggableView.git
- Add an UIView in storyboard and assign it
HHDraggableUIView
or createHHDraggableUIView
in swift directly
isDraggable
|Bool
|Default: true
(UIView should be able to move or not)applyInertia
|Bool
|Default: true
(Either UIView should move at the end of dragging by itself or not)inertiaDuration
|CGFloat
|Default: 1.5
(Duration for how long should inertia last)friction
|CGFloat
|Default: 2.0
(Value that affects inertia, more friction, quicker inertia will end)keepInScreen
|Bool
|Default: true
(Either UIView should be kept with in the screen or should go outside as well)snapToSides
|Bool
|Default: false
(Either the UIView should move to either side of screen or not)snapDuration
|CGFloat
|Default: 0.1
(Duration of snapping UIView for sides)
It is highly recommended to use either applyInertia
or snapToSides
. DO NOT use or make both of them true
at a time
Hamza Hasan, shamzahasan88@gmail.com
HHDraggableView is available under the MIT license. See the LICENSE file for more info.