title: Not getting the border at the bottom fit to textfield width
body: <p>Below is the image of the border at the bottom in UITextField.
  But not getting fully underline the UITextField.
  <a href="https://i.stack.imgur.com/cibSG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cibSG.png" alt="Not fully underline the TextField"></a></p>
  
  <p>Below is the code I am using.
      extension UITextField {</p>
  
  <pre><code>    func underlined(){
          let border = CALayer()
          let width = CGFloat(1.0)
          border.borderColor = UIColor.red.cgColor
          border.frame = CGRect(x: 0, y: self.frame.size.height - width, width:  self.frame.size.width, height: self.frame.size.height)
          border.borderWidth = width
          self.layer.addSublayer(border)
          self.layer.masksToBounds = true
      }
  
  }
  </code></pre>
  
  <p>// call</p>
  
  <pre><code>yourTextField.underlined()
  </code></pre>