title: Adding buttons to toolbar programmatically in swift
body: <p>I'm having a hard time adding a button to the toolbar in swift, below you can see an image of the toolbar that I'm after, unfortunately even though I have it designed in my Storyboard file, it doesn't show up when setting the toolbar to be  visible.</p>
  
  <p>The way that I have designed this is two items, the first being a <code>flexable space</code> element, and the second being an <code>add</code> element. It looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/tPFXA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tPFXA.png" alt="enter image description here"></a></p>
  
  <p>Here's the code that I've used to attempt to replicate this in code:</p>
  
  <pre><code>self.navigationController?.toolbarHidden = false
  self.navigationController?.toolbarItems = [UIBarButtonItem]()
  self.navigationController?.toolbarItems?.append(
      UIBarButtonItem(barButtonSystemItem: .FlexibleSpace, target: self, action: nil)
  )
  self.navigationController?.toolbarItems?.append(
      UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "onClickedToolbeltButton:")
  )
  </code></pre>
  
  <p>As you can see I'm setting the toolbar to be visible, initializing (and clearing) the toolbarItems array of UIBarButtonItem, and then adding two UIBarButtonItem's to the array, in the proper order.</p>
  
  <p>However, the toolbelt remains empty, why is this? </p>