Last active
December 4, 2020 10:51
-
-
Save aryasurya21/7f949f857e42363f48b805f5e797b215 to your computer and use it in GitHub Desktop.
Implementing UIPanGestureRecognizer. on ViewController for Draggable Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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