title: UITextField border-bottom will not be displayed fully
body: <p>I am new to the <code>Swift</code>, and I want to add the border-bottom to the <code>UITextField</code> (Full border to the <code>UITextField's</code> width). I search the internet and I found lots of the code but they are not functional as I wanted. </p>
  
  <p>My needs: I want that the border-bottom is set to be the full width of the <code>UITextField</code>.</p>
  
  <p>Output Image link: <a href="https://i.stack.imgur.com/Gdwix.png" rel="nofollow noreferrer">Chopped Image link</a></p>
  
  <pre><code>let border = CALayer()
  let width = CGFloat(0.5)
  border.borderColor = UIColor.darkGray.withAlphaComponent(1).cgColor
  border.frame = CGRect(x: 0, y: firstName.frame.size.height - width, width:  firstName.frame.size.width, height: firstName.frame.size.height)
  
  border.borderWidth = width
  firstName.layer.addSublayer(border)
  firstName.layer.masksToBounds = true
  </code></pre>