title: how to hide/view header view table in iOS swift
body: <p>I have static UItableview to hold user form. I added header view in the table to show email validation files  my problem is the header does not show a smooth transition between hiding/show and overlap with the first row
  <a href="https://i.stack.imgur.com/vxdnL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vxdnL.png" alt="enter image description here"></a></p>
  
  <p>I want to ask how I can fix the hight of the table header view and does not make it overlap
  code </p>
  
  <pre><code>@IBOutlet weak var errorView: UIView!
  
  @IBAction func next(_ sender: Any) {
      let newUserEmail = self.txtfEmail.text
      if isValidEmail(newUserEmail!) {
          performSegue(withIdentifier: "addInventryToNewUser", sender: self)
      }
      else {
          cellemail.layer.borderWidth = 2.0
          cellemail.layer.borderColor = UIColor.red.cgColor
  
          let f = errorView.frame;      
             errorView.frame = CGRect(x: f.origin.x, y: f.origin.y, width: f.width, height: 21);
          errorView.isHidden = false
  
          lblError.text = "❌ Invalid email address."
      }
  
  }
  </code></pre>