title: How add corner radius to dashed border around an UIView
body: <p>I have a rounded <code>UIView</code> and I have added a dashed line stroke to it.</p>
  
  <pre><code>,,,
      var view = CAShapeLayer()
      view.strokeColor = UIColor.red.cgColor
      view.lineDashPattern = [2, 2]
      view.frame = addphotoView.bounds
      view.fillColor = nil
      view.path = UIBezierPath(rect: addphotoView.bounds).cgPath
      view.cornerRadius = 16
      view.masksToBounds = true
  
      addphotoView.layer.addSublayer(yourViewBorder)
  </code></pre>
  
  <p>But <code>view.cornerRadius</code> is not working as expected:
  <a href="https://i.stack.imgur.com/r5cjC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/r5cjC.png" alt="Demo"></a></p>
  
  <blockquote>
    <p>Corner is wiped out. </p>
  </blockquote>