Skip to main content

Overview

As of version 8.0, IQKeyboardReturnManager is now an independent package, separated from the main IQKeyboardManager library. It automatically handles return key behavior, allowing users to navigate between text fields by pressing the return key.
IQKeyboardReturnManager was previously named IQReturnKeyHandler and was part of IQKeyboardManager. It has been renamed and extracted into its own package.

GitHub Repository

hackiftekhar/IQKeyboardReturnManager

Key Features

  • Automatic Return Key Handling - Navigate to next field or dismiss keyboard on return key press
  • Smart Navigation - Automatically moves to next text field when pressing return
  • Customizable Behavior - Configure return key type per field (Next, Done, etc.)
  • No Code Required - Works automatically once enabled
  • Delegate Pattern - Optional delegate methods for custom behavior

Installation

CocoaPods

Swift Package Manager

Carthage

Basic Usage

Enable Return Key Management

How It Works

  1. When the user presses return on a text field:
    • If there’s a next text field, it becomes first responder
    • If it’s the last text field, the keyboard dismisses
  2. Return key types are automatically configured:
    • “Next” for fields with a next field
    • “Done” for the last field

Configuration

Custom Delegate

Implement the delegate to customize behavior:

Manual Control

Migration from v7

See the Migration Guide for detailed migration instructions from IQKeyboardManager v7 to v8.

Key Changes

  1. Renamed - IQReturnKeyHandler → IQKeyboardReturnManager
  2. Separate Package - Now available as an independent library
  3. Initialization - Requires view controller instance in initializer

Before (v7)

After (v8)

Use Cases

Form Navigation

Ideal for forms where users should navigate between fields using the return key:

Custom Return Behavior

API Reference

Initialization

Creates a return key manager for the specified view controller.

Properties

Methods

Delegate Methods

Best Practices

Store the IQKeyboardReturnManager instance as a property to keep it in memory throughout the view controller’s lifetime.
Create one return key manager per view controller, not per text field.
IQKeyboardReturnManager works seamlessly with IQKeyboardManager. Use both together for complete keyboard handling:

IQKeyboardToolbarManager

Add Previous/Next/Done toolbar buttons

IQTextView

UITextView with placeholder support

See Also