What is IQKeyboardManager?
IQKeyboardManager is a codeless drop-in universal library that automatically prevents issues of the keyboard sliding up and coveringUITextField or UITextView in your iOS applications.
No code, no manual setup, no subclassing required. Simply enable it and it works.
The Problem It Solves
When developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers text fields or text views. This creates a poor user experience where users can’t see what they’re typing. Traditionally, solving this problem requires:- Manual UIScrollView management
- Tracking keyboard notifications
- Calculating content offsets
- Handling different screen sizes and orientations
- Writing repetitive code for every view controller
Key Benefits
One Line of Code
Just enable it in your AppDelegate and it works automatically
Works Automatically
No manual setup or configuration required per screen
No More UIScrollView
Automatically handles all scroll views, table views, and collection views
No More Subclasses
Works with standard UIKit components without subclassing
Universal Solution
Works across your entire app with all interface orientations
Modular Architecture
Include only the features you need via subspecs
Core Features
The library includes several powerful features:Always Included (Core)
- Automatic keyboard avoidance for UITextField/UITextView
- Support for UIScrollView, UITableView, UICollectionView
- All interface orientations supported
- Configurable keyboard distance
- Class-level enable/disable control
Optional Features (via Subspecs)
- Toolbar: Previous/Next/Done buttons above the keyboard
- Return Key Handling: Customize return key behavior
- Tap-to-Resign: Dismiss keyboard by tapping outside text fields
- Keyboard Appearance: Configure keyboard appearance globally
- IQTextView: UITextView with placeholder support
Architecture Overview
IQKeyboardManager uses a modular architecture organized into subspecs:Thread Safety
TheIQKeyboardManager class is marked with @MainActor to enforce thread safety at compile time. This means:
- All properties and methods must be accessed from the main thread
- The compiler will prevent accidental background thread access
- This ensures UI updates happen safely on the main thread
Requirements
Platform Requirements
| Component | Minimum iOS Version | Minimum Xcode |
|---|---|---|
| IQKeyboardManagerSwift | iOS 13.0 | Xcode 13 |
| Demo Project | iOS 13.0 | Xcode 15 |
Swift Version Compatibility
| Swift Version | Xcode Version | IQKeyboardManagerSwift Version |
|---|---|---|
| 5.9, 5.8, 5.7 | Xcode 16 | >= 7.0.0 |
| 5.9, 5.8, 5.7, 5.6 | Xcode 15 | >= 7.0.0 |
| 5.5, 5.4, 5.3, 5.2, 5.1, 5.0, 4.2 | Xcode 11 | >= 6.5.7 |
| 5.1, 5.0, 4.2, 4.0, 3.2, 3.0 | Xcode 11 | >= 6.5.0 |
| 5.0, 4.2, 4.0, 3.2, 3.0 | Xcode 10.2 | >= 6.2.1 |
| 4.2, 4.0, 3.2, 3.0 | Xcode 10.0 | >= 6.0.4 |
| 4.0, 3.2, 3.0 | Xcode 9.0 | 5.0.0 |
The current version (8.0.2) supports Swift 5.7, 5.8, and 5.9.
Important Notes
Third-Party Library Conflicts
If IQKeyboardManager conflicts with other third-party libraries, it’s the developer’s responsibility to enable/disable IQKeyboardManager when presenting/dismissing third-party library UI. Third-party libraries are not responsible for handling IQKeyboardManager.Next Steps
Installation
Install IQKeyboardManager using CocoaPods, SPM, or Carthage
Quick Start
Get up and running in less than 5 minutes