title: Draw Drop Shadow Outside UIView
body: <h2>Background</h2>
  
  <p>I have a <code>UIView</code> with the following properties: </p>
  
  <ul>
  <li>alpha = 1</li>
  <li>backgroundColor = white, with 0.35 opacity</li>
  <li>rounded corners</li>
  <li>drop shadow</li>
  </ul>
  
  <h2>Code</h2>
  
  <p>This is how I create the drop shadow: (<code>UIView</code> extension)</p>
  
  <pre><code>self.layer.masksToBounds = false
  self.layer.shadowColor = UIColor.darkGrayColor().CGColor
  self.layer.shadowOffset = CGSizeMake(0, 5)
  self.layer.shadowOpacity = 0.35
  self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: self.layer.cornerRadius).CGPath
  </code></pre>
  
  <h2>Results</h2>
  
  <p>This results in the following:</p>
  
  <p><a href="https://i.stack.imgur.com/oSSFS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oSSFS.png" alt="current result"></a></p>
  
  <p>...while I do not want to see the shadow beneath the view like this:</p>
  
  <p><a href="https://i.stack.imgur.com/1dEEO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1dEEO.png" alt="wished result"></a></p>
  
  <h2>Question</h2>
  
  <p>How can I draw the shadow outside the view only so it is not visible below it?</p>
  
  <p>Thanks in advance!</p>