title: Swift: Programmatically changing my UISegmentedControl's Items
body: <p>I want to change the items in my UISegmentedControl based off of another selection. I do not want to change the number of items, but simply the item labels, as well as the 'hidden' variable of the UISegmentedControl.</p>
  
  <p>Here is my code to get the UISegmentedControl:</p>
  
  <pre><code>@IBOutlet weak var viewPicker: UISegmentedControl!
  </code></pre>
  
  <p>and here is the code to change it:</p>
  
  <pre><code>viewPicker = UISegmentedControl(items: ["Description", "Location"])
  </code></pre>
  
  <p>However, this doesn't work and sometimes sets viewPicker to nil, giving an error. What is the best way to do this?</p>