title: How do I increase or decrease the size of a button in Swift?
body: <p>I have a <code>UIButton</code> in my app that I call "buttonPlay". I am using AutoLayout but the button doesn't have any <code>NSLayoutConstraints</code> attached to it.</p>
  
  <p>I would like to code an animation <strong>to increase and the decrease the height and the width</strong> of the button. Here's how the animation code looks like:</p>
  
  <pre><code>    // "Repeat" because the animation must repeat itself
      UIView.animateWithDuration(1.0, delay: 0.6, options: UIViewAnimationOptions.Repeat, animations: {
          // Animation code goes here
          // nil: the animation is not supposed to end
          }, completion: nil)
  }
  </code></pre>
  
  <p>To get the <strong>original values of the x position, y position, width and height</strong> I am using the following code: </p>
  
  <pre><code>var frmPlay : CGRect = self.buttonPlay.frame
  
  // get the current x and y positions
          let originXbutton = frmPlay.origin.x
          let originYbutton = frmPlay.origin.y
  
  // get the current width and height of the button     
          let originWidthbutton = frmPlay.size.width
          let originHeightbutton = frmPlay.size.height
  
  // set the frame (frmPlay) to the button frame
          self.buttonPlay.frame = frmPlay
  </code></pre>
  
  <p>Okay, it's now time to increase or decrease the width and the height of the animation. I'll put this code inside the <code>animation</code> block:</p>
  
  <pre><code>        self.buttonPlay.frame = CGRectMake(
              originXbutton,
              originYbutton,
              originWidthbutton-100,
              originHeightbutton)
  
          self.buttonPlay.frame = CGRectMake(
              originXbutton,
              originYbutton,
              originWidthbutton+100,
              originHeightbutton)
  </code></pre>
  
  <p>The animation code will look something like this:</p>
  
  <pre><code>    UIView.animateWithDuration(1.0, delay: 0.6, options: UIViewAnimationOptions.Repeat, animations: {
  
          println("Animation function animateStuff() started!")
  
          var frmPlay : CGRect = self.buttonPlay.frame
  
          let originXbutton = frmPlay.origin.x
          let originYbutton = frmPlay.origin.y
  
          let originWidthbutton = frmPlay.size.width
          let originHeightbutton = frmPlay.size.height
  
          self.buttonPlay.frame = frmPlay
  
          self.buttonPlay.frame = CGRectMake(
              originXbutton,
              originYbutton,
              originWidthbutton-100,
              originHeightbutton)
  
          self.buttonPlay.frame = CGRectMake(
              originXbutton,
              originYbutton,
              originWidthbutton+100,
              originHeightbutton)
  
          }, completion: nil)
  </code></pre>
  
  <p>Let's run the app. Uh oh! The button (also called buttonPlay) <strong>doesn't get bigger or smaller in any way</strong>. Though it moves from right to left. But hey! I haven't touched the x and the y positions code.</p>
  
  <p>What causes it?</p>