Skip to main content

Overview

IQKeyboardManager uses a modular architecture that allows you to include only the features you need. When installed via CocoaPods, the library is split into multiple subspecs that can be included independently.
When using Swift Package Manager (SPM), all modules are included by default. The subspec system is specific to CocoaPods installations.

Architecture Diagram

Default Installation

By default, all subspecs are included:
This installs:
  • Core
  • Appearance
  • IQKeyboardToolbarManager
  • IQKeyboardReturnManager
  • IQTextView
  • Resign

Core Subspecs

Core (Required)

The fundamental keyboard management functionality. Source Files: IQKeyboardManagerSwift/IQKeyboardManager/**/*.{swift} Features:
  • Main IQKeyboardManager class
  • Position adjustment logic
  • View hierarchy traversal
  • Configuration system (IQActiveConfiguration, IQRootControllerConfiguration, IQScrollViewConfiguration)
  • UIView extensions (.iq namespace)
  • ScrollView handling
  • Internal utilities
Dependencies:
  • IQKeyboardNotification - Keyboard event observing
  • IQTextInputViewNotification - Text field/text view focus tracking
Installation:
Usage:
The Core subspec must be included for IQKeyboardManager to function. All other subspecs depend on or extend Core functionality.

Appearance

Keyboard appearance customization functionality. Source Files: IQKeyboardManagerSwift/Appearance/**/*.{swift} Features:
  • IQKeyboardAppearanceManager - Central appearance coordinator
  • IQKeyboardAppearanceConfiguration - Appearance settings storage
  • Automatic keyboard appearance matching
  • Overrides UITextField/UITextView keyboard appearance
Dependencies:
  • IQTextInputViewNotification
Installation:
Key Classes:
Usage:

IQKeyboardToolbarManager

Toolbar with Previous/Next/Done buttons above the keyboard. Source Files: IQKeyboardManagerSwift/IQKeyboardToolbarManager/**/*.{swift} Features:
  • Automatic toolbar with navigation buttons
  • Previous/Next navigation between text fields
  • Done button to dismiss keyboard
  • Customizable toolbar appearance
  • Integration with IQKeyboardManager
Dependencies:
  • IQKeyboardToolbarManager (external module)
Installation:
Integration:
The toolbar manager provides:
  • Previous/Next buttons - Navigate between text fields in responder chain
  • Done button - Dismiss keyboard
  • Title label - Optional placeholder text display
  • Customization - Tint colors, fonts, button items
  • Automatic management - Enables/disables buttons based on responder chain
The toolbar is automatically added to text fields when enabled and removed when disabled.

IQKeyboardReturnManager

Automatic keyboard return key handling. Source Files: Bridge to external module Features:
  • Automatic return key handling
  • Move to next field on return key
  • Submit form on last field
  • Customizable return key types
  • Integration with responder chain
Dependencies:
  • IQKeyboardReturnManager (external module)
Installation:
Usage:
The return key manager automatically:
  1. Sets appropriate return key types (Next/Done)
  2. Moves to next field when return is tapped
  3. Dismisses keyboard on last field

IQTextView

Enhanced UITextView with placeholder support. Source Files: Bridge to external module Features:
  • Built-in placeholder support
  • Matches UITextField placeholder behavior
  • Customizable placeholder appearance
  • Automatic placeholder hiding/showing
Dependencies:
  • IQTextView (external module)
Installation:
Usage:
IQTextView is a standalone module that works independently of IQKeyboardManager but is commonly used together for enhanced text input functionality.

Resign

Keyboard dismissal by tapping outside text fields. Source Files: IQKeyboardManagerSwift/Resign/**/*.{swift} Features:
  • IQKeyboardResignHandler - Manages tap-to-dismiss
  • Automatic gesture recognizer management
  • Configurable dismiss behavior
  • Integration with IQKeyboardManager
Dependencies:
  • IQTextInputViewNotification
Installation:
Key Classes:
Integration:

Selective Installation

Minimal Installation

Install only core keyboard management:
This gives you:
  • Position adjustment
  • Keyboard distance handling
  • Basic configuration
  • No toolbar, no appearance, no resign

Core + Toolbar

Most common configuration for form-heavy apps:

Core + Resign

For apps that want tap-to-dismiss without toolbar:

Custom Combination

Mix and match based on needs:

Subspec Dependencies

Dependency Tree

External Dependencies

IQKeyboardManager relies on these external modules: IQKeyboardNotification (v1.0.6+)
  • Observes keyboard show/hide/change notifications
  • Provides animation synchronization
  • Used by: Core
IQTextInputViewNotification (v1.0.9+)
  • Tracks text field/text view focus changes
  • Monitors begin/end editing events
  • Used by: Core, Appearance, Resign
IQKeyboardToolbarManager (v1.1.4+)
  • Complete toolbar implementation
  • Button management and responder chain
  • Used by: IQKeyboardToolbarManager subspec
IQKeyboardReturnManager (v1.0.6+)
  • Return key handling logic
  • Responder chain navigation
  • Used by: IQKeyboardReturnManager subspec
IQTextView (v1.0.5+)
  • UITextView with placeholder
  • Standalone text view enhancement
  • Used by: IQTextView subspec

Podspec Configuration

Full Podspec Structure

Default Subspecs

The default_subspecs array defines what’s included with:
All six subspecs are included by default for maximum functionality.

Swift Package Manager

When using SPM, subspecs don’t apply. Install via Package.swift:
SPM automatically includes all dependencies:
Swift Package Manager doesn’t support the concept of subspecs. All modules are included as separate package products that you can import individually.

Choosing Subspecs

When to Use Each Subspec

Optimization Strategies

Minimize Binary Size
Forms & Navigation
Chat Apps
Simple Apps

Migration from Objective-C

If migrating from the Objective-C version (IQKeyboardManager), note:
  1. Different pod name: IQKeyboardManagerSwift vs IQKeyboardManager
  2. Subspec structure: Swift version has modular subspecs
  3. Import statements: import IQKeyboardManagerSwift

Best Practices

1. Start with Default Installation

Begin with full installation during development:

2. Profile and Optimize

After development, profile your app and remove unused subspecs:

3. Document Subspec Choices

Add comments explaining why subspecs were excluded:

4. Keep Dependencies Updated

Regularly update external dependencies:

5. Test Subspec Combinations

Test your specific subspec combination thoroughly:

Troubleshooting

Missing Functionality

Problem: Feature not available after selective installation Solution: Check if the feature is in an excluded subspec

Duplicate Symbols

Problem: Linker errors with duplicate symbols Solution: Don’t mix default and selective installation

Import Errors

Problem: Cannot import subspec-specific classes Solution: Always import the main module

Next Steps

Installation

Learn how to install IQKeyboardManager

Configuration

Configure IQKeyboardManager for your app