title: How to change button programmatically without outlet connection in swift
body: <p>I have a list of buttons inside an array. I want to replace the buttons position order using that array. I can do this in java, but cant do the same in swift. Here is my code: </p>
  
  <pre><code>@IBOutlet weak var menuView: UIView!
  
  struct ButtonsIndex {
    var button: UIButton
    var index: Int
  }
  
  var footer: [ButtonsIndex] = []
  
  //Set Buttons order etc
  ...
  
  func setFooter(){
   let count = 0
   for buttons in menuView.subviews {
    if var button = buttons as? UIButton {
     button = footer[count].button
     count += 1
    }
   }
  }
  </code></pre>
  
  <p>Is it impossible to change the buttons position without connecting the outlets to my code? Thanks in advance.</p>