---
# System prepended metadata

title: My First HackMD

---

# My First HackMD

>## swift: UIPanGestureRecognizer()

:::info
Hi! my name is Cruise, So I test this first, hope can find something that can help me group up.
:::

```swift=
let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(panAction(_:)))
floatingButton.isUserInteractionEnabled = true
floatingButton.addGestureRecognizer(panGestureRecognizer)
```
:::info
This is a GestureRecognizer, that add to the button or other object, and you
will recive some value in your method like:
:::
```swift=
@objc func panAction(_ sender: UIPanGestureRecognizer) {
    
}
```
:::info
So, you can show info of sender, let me show position, when user draging your object, example:
:::
```swift=
@objc func panAction(_ sender: UIPanGestureRecognizer) {
    let translation: CGPoint = sender.translation(in: yourView)
    print(translation)
}

```
:::info
Check your console, that you can see. 
:::

:::success
Okay,hope you enjoy your coding time, see you !
:::