title: How to add button to stackview using for loop in swift?
body: <p>I have created a stackview using xib and want to add button to it programatically. I tried to create button and addArrangedSubview to stackview but the button is not shown.
  My code:</p>
  <pre><code>for item in 1...5 {
     let button = UIButton()
      button.setTitle(&quot;Button \(item)&quot;, for: .normal)
      self?.stackView.addArrangedSubview(button)
  }
  </code></pre>