title: Repeat image in view horizontally and vertically
body: <p>i know <a href="https://stackoverflow.com/questions/30001569/repeat-image-horizontally-and-vertically">this</a> question repeat but i cant get sultion</p>
  
  <p><strong>I have this image</strong></p>
  
  <p><a href="https://i.stack.imgur.com/sRUk1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sRUk1.png" alt=""></a></p>
  
  <p><strong>And i want view background like this</strong></p>
  
  <p><a href="https://i.stack.imgur.com/vJmqI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vJmqI.png" alt="enter image description here"></a></p>
  
  <p>i have tried all the this</p>
  
  <p><strong>i also try this</strong></p>
  
  <pre><code>self.view.backgroundColor = UIColor(patternImage: 
                    UIImage(named: "backgroundicon.png")!)
  </code></pre>
  
  <p><strong>Thank you in advance</strong></p>
  
  <p><strong>EDIT :</strong></p>
  
  <pre><code> UIGraphicsBeginImageContext(self.view.frame.size)
   UIImage(named: "backgroundicon.png")?.draw(in: self.view.bounds)
  
   let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
  
   UIGraphicsEndImageContext()
  
   self.view.backgroundColor = UIColor(patternImage: image)
  </code></pre>
  
  <p><strong>Result :</strong></p>
  
  <p><a href="https://i.stack.imgur.com/mGZ78.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mGZ78.png" alt="enter image description here"></a></p>