title: Swift - changing image view background image via segmented control
body: <p>The title itself explains as much as i will be able to. Basically, i have a segmented control that i want to change the image within my image view after each segment is selected, but i can't seem to apply or find the logic to resolve my problem. The answer itself is probably very simple, but i'm really new to Swift and didn't manage to find an answer anywhere, so i would love a solution to my problem. Thanks!</p>
  
  <pre><code>@IBOutlet weak var newImageView: UIImageView!
  
  @IBAction func chooseImage(sender: AnyObject) {
      if myPhotoSegment.selectedSegmentIndex == 0
      {
  
          newImageView = UIImage(named: "3.jpg")
  
  
      }
  
  
      if myPhotoSegment.selectedSegmentIndex == 1
      {
  
  
      }
  </code></pre>