UITextField-Navigation is an open-source library that provides a convenient way to navigate between text fields in iOS applications. It allows users to easily move from one text field to another by tapping the “Next” or “Previous” buttons on the keyboard.


  • Easily navigate between multiple text fields
  • Supports both “Next” and “Previous” buttons on the keyboard
  • Customizable appearance and behavior
  • Lightweight and easy to integrate
  • Compatible with all versions of iOS


To install UITextField-Navigation in your project, you can use CocoaPods. Simply add the following line to your Podfile:

pod 'UITextField-Navigation'

Then run the command pod install in your terminal.

If you prefer not to use CocoaPods, you can manually download the source files from the GitHub repository and add them to your project.


1. Import the library by adding the following import statement to your view controller:

import UITextField_Navigation

2. Make sure your view controller conforms to the UITextFieldDelegate protocol by adding it after the class declaration:

class ViewController: UIViewController, UITextFieldDelegate {

3. Create an instance variable for the UITextFieldNavigationHandler class in your view controller:

var textFieldNavigationHandler: UITextFieldNavigationHandler?

4. In your viewDidLoad() method, set the textFieldNavigationHandler variable to a new instance of UITextFieldNavigationHandler:

textFieldNavigationHandler = UITextFieldNavigationHandler(textFields: [textField1, textField2, textField3])

Replace textField1, textField2, and textField3 with the actual instances of UITextField in your view controller.

5. Implement the textFieldShouldReturn(_:) method from the UITextFieldDelegate protocol. Inside the method, call the textFieldNavigationHandler‘s handleTextFieldNavigation(_:) method:

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    return textFieldNavigationHandler?.handleTextFieldNavigation(textField) ?? false

That’s it! Now you can navigate between text fields by tapping the “Next” and “Previous” buttons on the keyboard.


UITextField-Navigation provides several ways to customize its appearance and behavior:

  1. Button Appearance: You can customize the appearance of the “Next” and “Previous” buttons on the keyboard by setting the nextButtonStyle and previousButtonStyle properties of the UITextFieldNavigationHandler instance.
  2. Button Behavior: By default, tapping the “Next” button will focus the next text field, and tapping the “Previous” button will focus the previous text field. You can modify this behavior by implementing the textFieldNavigationHandler(_:shouldNavigateToNextTextFieldFrom:) and textFieldNavigationHandler(_:shouldNavigateToPreviousTextFieldFrom:) methods in the UITextFieldDelegate protocol.
  3. Keyboard Toolbar: If you prefer to use a custom toolbar with additional buttons, you can set the showKeyboardToolbar property of the UITextFieldNavigationHandler instance to true, and provide a custom toolbar view by setting the keyboardToolbar property.


UITextField-Navigation is a helpful library for iOS developers that simplifies text field navigation in their applications. With its easy integration and customizable features, it provides a seamless user experience and saves time during form input.

For more information, you can check out the GitHub repository and explore the provided examples and documentation.