Skip to content

Instantly share code, notes, and snippets.

@fisherds
Last active January 2, 2018 17:08
Show Gist options
  • Select an option

  • Save fisherds/f48804988b50fd7608f7 to your computer and use it in GitHub Desktop.

Select an option

Save fisherds/f48804988b50fd7608f7 to your computer and use it in GitHub Desktop.
Implementation of our TouchesViewController in the first day demo
import UIKit
class TouchesAndViewsViewController: UIViewController {
@IBOutlet weak var logoImageView: UIImageView!
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
if let touch = touches.first {
let position = touch.location(in: view)
print(position)
UIView.beginAnimations(nil, context: nil)
logoImageView.center = position
UIView.commitAnimations()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment