title: Swift - Cut hole in shadow layer
body: <p>I want to "cut a hole" in the shadow layer of a UIView an Swift3, iOS  </p>
  
  <p>I have a container (UIView), that has 2 children:  </p>
  
  <ul>
  <li>one UIImageView</li>
  <li>one UIView on top of that image ("overlay")</li>
  </ul>
  
  <p>I want to give the overlay a shadow and cut out an inner rect of that shadow, to create a glow-like effect at the edges of the ImageView<br>
  It is crucial that the glow is inset, since the image is taking the screen width<br>
  My code so far:</p>
  
  <pre><code>let glowView = UIView(frame: CGRect(x: 0, y: 0, width: imageWidth, height: imageHeight))
  glowView.layer.shadowPath = UIBezierPath(roundedRect: container.bounds, cornerRadius: 4.0).cgPath
  glowView.layer.shouldRasterize = true
  glowView.layer.rasterizationScale = UIScreen.main.scale
  glowView.layer.shadowOffset = CGSize(width: 1.0, height: 1.0)
  glowView.layer.shadowOpacity = 0.4
  
  container.addSubview(imageView)
  container.addSubview(glowView)
  </code></pre>
  
  <p>The result looks like the following right now:  </p>
  
  <p><a href="https://i.stack.imgur.com/BBKCt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BBKCt.png" alt="image"></a></p>
  
  <p>Now I would like to cut out the darker inner part, so that just the shadow at the edges remains<br>
  Any idea how to achieve this?</p>