title: How to set background image in swift?
body: <p>I am trying to set aground image to my ViewController in swift language.</p>
  
  <p>I am using the following code :</p>
  
  <pre><code>self.view.backgroundColor = UIColor(patternImage: UIImage(named:”bg.png")!)
  </code></pre>
  
  <p>But the app is getting crash.It is showing the error like</p>
  
  <blockquote>
    <p>“fatal error: unexpectedly found nil while unwrapping an Optional
    value”(Because of the “!”)</p>
  </blockquote>