SkillAgentSearch skills...

AADraggableView

AADraggableView is a light-weight and easy-to-use draggable views in screen bounds with options designed to drag any UIView. It allows to drag the UIView in any view controller.

Install / Use

/learn @EngrAhsanAli/AADraggableView
About this skill

Quality Score

0/100

Category

Design

Supported Platforms

Universal

README

Table of Contents

<div id='section-id-4'/>

#AADraggableView

Swift 3.0 Carthage compatible CocoaPods License MIT Build Status License MIT CocoaPods

<div id='section-id-10'/>

##Description

AADraggableView is a light-weight and easy-to-use draggable views in screen bounds with options designed to drag any UIView. It allows to drag the UIView in any view controller.

<div id='section-id-16'/>

##Demonstration

You can define repositioning after dragging by following values:

-- sticky

View will stick with the edges with padding.

-- free

View will free to move in whole screen

-- edgesOnly

View will stick with nearby edges only

-- topOnly

View will stick with top edge

-- bottomOnly

View will stick with bottom edge

-- leftOnly

View will stick with left edge

-- rightOnly

View will stick with right edge

To run the example project, clone the repo, and run pod install from the Example directory first.

<div id='section-id-26'/>

##Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3+
<div id='section-id-32'/>

Installation

AADraggableView can be installed using CocoaPods, Carthage, or manually.

<div id='section-id-37'/>

##CocoaPods

AADraggableView is available through CocoaPods. To install CocoaPods, run:

$ gem install cocoapods

Then create a Podfile with the following contents:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target '<Your Target Name>' do
pod 'AADraggableView'
end

Finally, run the following command to install it:

$ pod install
<div id='section-id-63'/>

##Carthage

To install Carthage, run (using Homebrew):

$ brew update
$ brew install carthage

Then add the following line to your Cartfile:

github "EngrAhsanAli/AADraggableView" "master"

Then import the library in all files where you use it:

import AADraggableView
<div id='section-id-82'/>

##Manual Installation

If you prefer not to use either of the above mentioned dependency managers, you can integrate AADraggableView into your project manually by adding the files contained in the Classes folder to your project.

<div id='section-id-87'/>

#Getting Started

<div id='section-id-90'/>

##Create object of draggable view

Drag UIView object from the Object Library into your UIViewController in storyboard.

<div id='section-id-104'/>

##Set view object as draggable view

Set the view's class to AADraggableView in the Identity Inspector. Make sure the module property is also set to AADraggableView.

<div id='section-id-112'/>

##Set properties and usage

You can set following properties in viewDidLoad method in your view controller.

Usage:

// IBOutlet for AADraggableView
@IBOutlet weak var view: AADraggableView

// Set options
view.delegate = self // AADraggableViewDelegate
view.respectedView = // reference view
view.reposition = // Reposition option
view.repositionIfNeeded() // Auto correct reposition

// Add delegate methods and observe changes!
func draggingDidBegan(_ sender: UIView) {
// Dragging did began of sender
}

func draggingDidEnd(_ sender: UIView) {
// Dragging did end of sender
}
<div id='section-id-150'/>

##Properties with description

You can use following properties:

| Properties | Types | Description | |-----------------|----------------|--------------------------------------------| | padding | CGFloat | Padding from edges when reposition | | duration | TimeInterval | Animaiton duration for reposition | | respectedView | UIView? | Respected UIView for reference view bounds | | reposition | Reposition | Reposition enum with options | | isEnabled | Bool | User dragging enable or disable |

<div id='section-id-156'/>

#Contributions & License

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

Pull requests are welcome! The best contributions will consist of substitutions or configurations for classes/methods known to block the main thread during a typical app lifecycle.

I would love to know if you are using AADraggableView in your app, send an email to Engr. Ahsan Ali

View on GitHub
GitHub Stars42
CategoryDesign
Updated6mo ago
Forks7

Languages

Swift

Security Score

82/100

Audited on Sep 14, 2025

No findings