title: create UIbutton programmatically with constraints in swift
body: <p><img src="https://i.stack.imgur.com/XoU6q.png" alt="enter image description here">Thanks in advance for the help.</p>
  
  <p>I want to create a new custom UIButton every time I click an ADD button.</p>
  
  <p>Once I click the add button, I want the add button to slide over and make room for the new button. I want this to happen every time, then create a new row once the buttons fill up the horizontal space of the view</p>
  
  <p>How would I got about doing this?</p>
  
  <p>Note:</p>
  
  <p>I definitely understand how to create a button programmatically, its the constraints/way of getting the buttons to animate sliding over, and spacing correctly that I don't understand</p>
  
  <p>Thank you so much </p>
  
  <p>The image is a quick idea of what I want it to look like. Top row is before I added several buttons, and bottom row is having so many buttons a new row is required</p>