title: I am having an issue When I am Giving Top Border to my View
body: <p>When I am giving Top border to my view it is not properly working. Also I am using it in collection view <code>cellforitematIndexPath</code></p>
  
  <pre><code> func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "CellRID")
  
      cell.viewForTotalMB.addTopBorderWithColor(color: UIColor(red: 72/255, green: 175/255, blue: 230/255, alpha: 1.0), width: 1)
      cell.viewForTotalMB.layer.masksToBounds = false
  
  
  
      return cell!
  }
  </code></pre>
  
  <p>I am using this extension for Borders</p>
  
  <pre><code>extension UIView {
  
  // lbl and txtfld Border line
  
  func addTopBorderWithColor(color: UIColor, width: CGFloat) {
      let border = CALayer()
      border.backgroundColor = color.cgColor
      border.frame = CGRect(x:0,y: 0, width:self.frame.size.width, height:width)
      self.layer.addSublayer(border)
  }
  
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/iJK0B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iJK0B.png" alt="enter image description here"></a></p>