title: How can I move an image in Swift?
body: <p>I would like to be able to move an object (in my case, an image "puppy") up 1 pixel every time a button is pressed. I've stumbled upon old Objective-C solutions as well as Swift code that was similar, but none that fit my specific problem. I would love to know an easy way to move my image. This is my code so far from what I could gather(I'm hoping it's unnecessarily long and can be reduced to a line or two):</p>
  
  <pre><code>@IBAction func tapButton() {
  UIView.animateWithDuration(0.75, delay: 0, options: UIViewAnimationOptions.CurveLinear, animations: {
              self.puppy.alpha = 1
              self.puppy.center.y = 0
              }, completion: nil)
  
          var toPoint: CGPoint = CGPointMake(0.0, 1.0)
          var fromPoint : CGPoint = CGPointZero
  
          var movement = CABasicAnimation(keyPath: "movement")
          movement.additive = true
          movement.fromValue =  NSValue(CGPoint: fromPoint)
          movement.toValue =  NSValue(CGPoint: toPoint)
          movement.duration = 0.3
  
          view.layer.addAnimation(movement, forKey: "move")
  }
  </code></pre>