title: keyboard overlapping UITextField in Swift 4
body: <p>i am trying to handle the scrolling of UITextField to avoid the keyboard to overlap it. <a href="https://i.stack.imgur.com/zBWuo.gif" rel="nofollow noreferrer">Click here to view  current OUTPUT i am getting</a> ]<a href="https://i.stack.imgur.com/JugV1.jpg" rel="nofollow noreferrer">StoryBoard Screenshot</a>. I tried to scroll the view when i click on the last textfield ..ie password field. When i click on the password field, only the email field ie the 2nd one is scrolling up. No scroll occur ion the first and last field. How can i solve this issue? </p>
  
  <p>`</p>
  
  <pre><code>//
  //  ViewController.swift
  
  
  import UIKit
  
  class ViewController: UIViewController,UITextFieldDelegate {
  
      @IBOutlet weak var scrollView: UIScrollView!
  
      @IBOutlet weak var name: UITextField!
  
      @IBOutlet weak var email: UITextField!
  
  
      @IBOutlet weak var password: UITextField!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          // Do any additional setup after loading the view, typically from a nib.
      }
  
      func textFieldDidBeginEditing(_ textField: UITextField) {
          // Begin
          switch textField.tag {
          case 0...1:
              print("DO NOTHING")
          default:
              print("Do Scroll")
  
              scrollView.setContentOffset(CGPoint(x:0,y:100) , animated: true)
          }
  
      }
  
      func textFieldDidEndEditing(_ textField: UITextField) {
          // End
          scrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: true)
  
      }
      func textFieldShouldReturn(_ textField: UITextField) -&gt; Bool {
           // Return
  
          if textField.tag == 0
          {
              email.becomeFirstResponder()
          }
          else if textField.tag == 1
          {
              password.becomeFirstResponder()
  
          }
          else if textField.tag == 2
          {
              textField.resignFirstResponder()
  
          }
          return true
      }
  
  
  }
  </code></pre>
  
  <p>`</p>