Skip to content

Instantly share code, notes, and snippets.

@aryasurya21
Last active December 4, 2020 10:51
Show Gist options
  • Save aryasurya21/7f949f857e42363f48b805f5e797b215 to your computer and use it in GitHub Desktop.
Save aryasurya21/7f949f857e42363f48b805f5e797b215 to your computer and use it in GitHub Desktop.
Implementing UIPanGestureRecognizer. on ViewController for Draggable Demo
//
// ViewController.swift
// draggabledemo
//
// Created by Philip Indra Prayitno ( https://github.com/s1rent ) on 03/12/20
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var draggableView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
self.draggableView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handler)))
}
@objc func handler(gesture: UIPanGestureRecognizer){
print(gesture.location(in: self.view))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment