title: How to access Image Assets like an array in Swift
body: <p>In my app I'm allowing the user the change some of the UI elements based on color. So, I have three versions of an image which can be used for a button and I'd like to select the image programmatically:</p>
  
  <pre><code>PSEUDO CODE
  "image0", "image1", "image3"
  var userChoice:integer
  
  myButton.setImage("myImage"+userChoice , .normal)
  </code></pre>
  
  <p>I've seen this solution in SO:
  <a href="https://stackoverflow.com/questions/30584992/programmatically-access-image-assets">Programmatically access image assets</a></p>
  
  <p>What would be the Swift equivalent code?</p>
  
  <p>Right now I'm using image literal:</p>
  
  <pre><code>self.But_Settings.setImage(#imageLiteral(resourceName: "settingswhite"), for: UIControlState.normal)
  </code></pre>
  
  <p>but of course Xcode changes this part "#imageLiteral(resourceName: "settingswhite")" to an icon which cannot be edited.</p>