title: How to create a UIButton and set frame using CGRect?
body: <p>hello I would like to ask a question, but if in object c to create a button with a given position (eg) </p>
  
  <pre><code>   # define kWidthButton 120 
     # define kHeightButton 80 
  
     - (UIButton*)createButtonWithIndex:(int)index{
     int row = index / 2; 
     int column = index %2; 
     UIButton * newButton = [UIButton buttonWithType: UIButtonTypeRoundedRect];
     newButton.frame = CGRectMake (* kWidthButton column, row * kHeightButton, kWidthButton, kHeightButton); 
     }
  </code></pre>
  
  <p>how can I make swift ? </p>
  
  <p>I found to create a button that you can do it this way but for that value index in swift</p>
  
  <pre><code>let button   = UIButton.buttonWithType(UIButtonType.System) as UIButton
      button.frame = CGRectMake(100, 100, 100, 50)
  </code></pre>