title: Drawing a rectangle with only two rounded corners using Bezier Path and Storyboarding in Swift 2.3
body: <p>I have <code>Table View</code> with 5 cells as described below. The intent is to have a <code>topRoundedBorderCell</code> with a white fill and just the <code>TopLeft</code> and <code>TopRight</code> borders rounded, then have the flexibility to add as many cells as needed with the white fill and squared corners for as many options as desired, lastly the <code>bottomRoundedCornerCell</code> will have the white fill with just the <code>BottomLeft</code> and <code>BottomRight</code> corners rounded. Creating the illusion of one long white box with rounded corners that fits all of the options pertaining to one group. 
  Shown below.</p>
  
  <p><strong><em>Storyboard cells breakdown:</em></strong></p>
  
  <p><a href="https://i.stack.imgur.com/o4ocy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o4ocy.png" alt="enter image description here"></a></p>
  
  <p><strong><em>When I run the app:</em></strong></p>
  
  <p><a href="https://i.stack.imgur.com/xD8xq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xD8xq.jpg" alt="enter image description here"></a></p>
  
  <p>However, as you can see in the 2nd image, only the <code>TopLeft</code> border is rounded, the rest remain squared.</p>
  
  <p>I am using the Bezier Path <code>roundedRect</code> method in 2 separate classes of type <code>UIView</code> which I assign to the respective <code>views</code> through my <code>Storyboard</code>.</p>
  
  <p><strong><em>Top Rounded Borders View:</em></strong></p>
  
  <pre><code>class TopRectangleRoundedCornersView: UIView {
  
      override func awakeFromNib() {
  
          let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: [UIRectCorner.TopLeft , UIRectCorner.TopRight], cornerRadii: CGSize(width:10.0, height:10.0))
          let mask = CAShapeLayer()
          mask.path = path.CGPath
          self.layer.mask = mask
          self.layer.backgroundColor = UIColor.whiteColor().CGColor //white fill
      }
  
  }
  </code></pre>
  
  <p><strong><em>Bottom Rounded Borders View:</em></strong></p>
  
  <pre><code>class BottomRectangleRoundedCornersView: UIView {
  
      override func awakeFromNib() {
          let path = UIBezierPath(roundedRect: self.bounds,
                                  byRoundingCorners: [UIRectCorner.BottomLeft, UIRectCorner.BottomRight], cornerRadii: CGSize(width: 10.0, height: 10.0))
          let mask = CAShapeLayer()
          mask.path = path.CGPath
          self.layer.mask = mask
          self.layer.backgroundColor = UIColor.whiteColor().CGColor //white fill
      }
  }
  </code></pre>