Skip to main content

Overview

As of version 8.0, IQKeyboardToolbarManager is now an independent package, separated from the main IQKeyboardManager library. It provides automatic toolbar management with Previous/Next/Done buttons above the keyboard.
IQKeyboardToolbarManager was previously part of IQKeyboardManager core but has been extracted into its own package for better modularity and flexibility.

GitHub Repository

hackiftekhar/IQKeyboardToolbarManager

Key Features

  • Automatic Toolbar Creation - Automatically adds Previous/Next/Done buttons above the keyboard
  • Navigation Between Fields - Seamlessly navigate between text input fields
  • Customizable Toolbar - Configure toolbar appearance, buttons, and behavior
  • Deep Responder Support - Navigate across text fields in different container views
  • Class-Level Control - Enable/disable toolbar for specific view controllers

Installation

CocoaPods

# Install IQKeyboardToolbarManager independently
pod 'IQKeyboardToolbarManager'

# Or as a subspec of IQKeyboardManager for easier migration
pod 'IQKeyboardManagerSwift/IQKeyboardToolbarManager'

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/hackiftekhar/IQKeyboardToolbarManager.git", from: "2.0.0")
]

Carthage

github "hackiftekhar/IQKeyboardToolbarManager"

Basic Usage

Standalone Usage

When using IQKeyboardToolbarManager as an independent package:
import IQKeyboardToolbarManager

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        // Enable toolbar management
        IQKeyboardToolbarManager.shared.isEnabled = true
        
        return true
    }
}

Integration with IQKeyboardManager

If you’re using IQKeyboardManager, you can enable the toolbar through the deprecated compatibility layer:
import IQKeyboardManagerSwift

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    
    // Enable keyboard management
    IQKeyboardManager.shared.isEnabled = true
    
    // Enable toolbar (deprecated - forwards to IQKeyboardToolbarManager)
    IQKeyboardManager.shared.enableAutoToolbar = true
    
    return true
}
The IQKeyboardManager.shared.enableAutoToolbar property is deprecated. For new projects, use IQKeyboardToolbarManager.shared.isEnabled directly.

Configuration

Toolbar Customization

import IQKeyboardToolbarManager

// Access toolbar configuration
let config = IQKeyboardToolbarManager.shared.toolbarConfiguration

// Customize appearance
config.tintColor = .systemBlue
config.backgroundColor = .systemGray6
config.barStyle = .default
// Check if navigation is possible
if IQKeyboardToolbarManager.shared.canGoNext {
    IQKeyboardToolbarManager.shared.goNext()
}

if IQKeyboardToolbarManager.shared.canGoPrevious {
    IQKeyboardToolbarManager.shared.goPrevious()
}

// Reload toolbar button states
IQKeyboardToolbarManager.shared.reloadInputViews()

Class-Level Control

// Disable toolbar for specific view controllers
IQKeyboardToolbarManager.shared.disabledToolbarClasses = [
    LoginViewController.self,
    SignupViewController.self
]

// Enable toolbar only for specific view controllers
IQKeyboardToolbarManager.shared.enabledToolbarClasses = [
    FormViewController.self
]

Deep Responder Containers

Allow navigation between text fields in custom container views:
// Allow navigation across custom container views
IQKeyboardToolbarManager.shared.deepResponderAllowedContainerClasses = [
    UITableViewCell.self,
    UICollectionViewCell.self,
    CustomFormView.self
]

Per-Field Customization

Ignore Previous/Next Navigation

import IQKeyboardToolbarManager

// Exclude a specific text field from toolbar navigation
textField.iq.ignoreSwitchingByNextPrevious = true

Migration from v7

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

Key Changes

  1. Separate Package - IQKeyboardToolbarManager is now independent
  2. Property Rename - enableAutoToolbarisEnabled
  3. Configuration Changes - IQToolbarConfigurationIQKeyboardToolbarConfiguration
  4. Class Renames - IQPreviousNextViewIQDeepResponderContainerView

Before (v7)

import IQKeyboardManagerSwift

IQKeyboardManager.shared.enableAutoToolbar = true
IQKeyboardManager.shared.toolbarConfiguration.tintColor = .blue

After (v8)

import IQKeyboardToolbarManager

IQKeyboardToolbarManager.shared.isEnabled = true
IQKeyboardToolbarManager.shared.toolbarConfiguration.tintColor = .blue

API Reference

Core Properties

PropertyTypeDescription
isEnabledBoolEnable/disable automatic toolbar management
toolbarConfigurationIQKeyboardToolbarConfigurationToolbar appearance and behavior settings
playInputClicksBoolPlay click sound on button tap
isDebuggingEnabledBoolEnable debug logging
Property/MethodTypeDescription
canGoPreviousBoolCheck if previous navigation is possible
canGoNextBoolCheck if next navigation is possible
goPrevious()@discardableResult funcNavigate to previous text field
goNext()@discardableResult funcNavigate to next text field
reloadInputViews()funcRefresh toolbar button states

Class Management

PropertyTypeDescription
disabledToolbarClasses[UIViewController.Type]View controllers where toolbar is disabled
enabledToolbarClasses[UIViewController.Type]View controllers where toolbar is force-enabled
deepResponderAllowedContainerClasses[UIView.Type]Container views to search for text fields

IQKeyboardReturnManager

Automatic return key handling

IQTextView

UITextView with placeholder support

See Also

Build docs developers (and LLMs) love