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/IQKeyboardReturnManagerKey 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
-
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
-
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
- Renamed -
IQReturnKeyHandler→IQKeyboardReturnManager - Separate Package - Now available as an independent library
- 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
Properties
Methods
Delegate Methods
Best Practices
Keep Manager in Memory
Keep Manager in Memory
Store the
IQKeyboardReturnManager instance as a property to keep it in memory throughout the view controller’s lifetime.One Manager Per View Controller
One Manager Per View Controller
Create one return key manager per view controller, not per text field.
Use with IQKeyboardManager
Use with IQKeyboardManager
IQKeyboardReturnManager works seamlessly with IQKeyboardManager. Use both together for complete keyboard handling:
Related Resources
IQKeyboardToolbarManager
Add Previous/Next/Done toolbar buttons
IQTextView
UITextView with placeholder support