How to tile an image from center using UIColor patternImage in Swift
<p>I have a method for repeating or tiling an image across a view using <code>UIColor</code> <code>patternImage</code>:</p>

<p><code>view.backgroundColor = UIColor(patternImage: UIImage(named:imageName))</code></p>

<p>The default behaviour of <code>UIColor</code> <code>patternImage</code> is to start the pattern from the top left, the result shown in Image 1.</p>

<p><strong>Question:</strong></p>

<p><strong>How can I get <code>UIColor</code> <code>patternImage</code> to start always from the very center of a view, patterning outwards to give the result shown in Image 2?</strong></p>

<p><a href="https://i.stack.imgur.com/fh0wL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fh0wL.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/XRi3j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XRi3j.png" alt="enter image description here"></a></p>