Skip to content

Instantly share code, notes, and snippets.

@ramiresnas
Created March 18, 2019 20:02
Show Gist options
  • Save ramiresnas/cb0464a817b15405d5ec0e2d02b860ef to your computer and use it in GitHub Desktop.
Save ramiresnas/cb0464a817b15405d5ec0e2d02b860ef to your computer and use it in GitHub Desktop.
Move
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else {
return
}
if let view = touch.view as? UIImageView {
selectedView = view
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else {
return
}
if let view = selectedView {
let location = touch.location(in: boxDraw)
if boxDraw.bounds.contains(location) {
view.layer.position = location
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment