Skip to main content

Overview

Version 6.0 brings refined API naming, new customization options, and improved view hierarchy handling. The changes are relatively minimal compared to later versions, making this one of the smoother migrations.
This migration primarily involves updating a few method names and optionally adopting new features.

Breaking Changes

IQKeyboardManager Shared Instance

The class method for accessing the shared instance has been simplified:
let manager = IQKeyboardManager.sharedManager()
Both sharedManager() and shared may work in v6 due to backwards compatibility, but shared is the preferred API going forward.

UIView Extension Method Rename

The method to get a view’s containing view controller has been renamed for clarity:
let controller = view.viewController()

New Features in v6

Version 6.0 introduces several new customization options:

Placeholder Color Customization

You can now customize the color of toolbar placeholders:
import IQKeyboardManagerSwift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    IQKeyboardManager.shared.enable = true
    
    // New in v6: Customize placeholder colors
    IQKeyboardManager.shared.placeholderColor = .gray
    IQKeyboardManager.shared.placeholderButtonColor = .systemBlue
    
    return true
}

Additional Safe Area Insets

Experimental Feature: This feature was marked as experimental in v6 and was removed in v7.
// Available in v6 only (removed in v7)
IQKeyboardManager.shared.canAdjustAdditionalSafeAreaInsets = true

UIView Customization Properties

Ignore Next/Previous Switching

Control whether specific text fields participate in the Previous/Next navigation:
// New in v6
textField.ignoreSwitchingByNextPrevious = true

Resign on Touch Outside Mode

Fine-grained control over dismiss-on-tap behavior per text field:
// New in v6
textField.shouldResignOnTouchOutsideMode = .enabled  // Always resign
textField.shouldResignOnTouchOutsideMode = .disabled // Never resign
textField.shouldResignOnTouchOutsideMode = .default  // Use global setting

Parent Container View Controller

New helper method to get the parent container view controller:
// New in v6
if let container = textField.parentContainerViewController() {
    print("Container: \(container)")
}

Migration Steps

1

Update Dependency

Update your Podfile or Package.swift to version 6.0+
# CocoaPods
pod 'IQKeyboardManagerSwift', '~> 6.0'
// Swift Package Manager
.package(url: "https://github.com/hackiftekhar/IQKeyboardManager.git", from: "6.0.0")
2

Install Dependencies

# CocoaPods
pod install

# Swift Package Manager
# File > Packages > Update to Latest Package Versions
3

Update Shared Instance Access

Replace sharedManager() with shared:
// Before
IQKeyboardManager.sharedManager().enable = true

// After
IQKeyboardManager.shared.enable = true
Use find-and-replace to update all instances:
  • Find: IQKeyboardManager.sharedManager()
  • Replace: IQKeyboardManager.shared
4

Update View Controller Method

Replace viewController() with viewContainingController():
// Before
let controller = view.viewController()

// After
let controller = view.viewContainingController()
5

Build and Test

  • Build your project
  • Test keyboard behavior
  • Verify no deprecation warnings appear
6

Adopt New Features (Optional)

Consider using new v6 features:
// Customize placeholder appearance
IQKeyboardManager.shared.placeholderColor = .secondaryLabel
IQKeyboardManager.shared.placeholderButtonColor = .systemBlue

// Fine-tune specific text fields
passwordTextField.ignoreSwitchingByNextPrevious = true
searchField.shouldResignOnTouchOutsideMode = .enabled

Complete Migration Example

import IQKeyboardManagerSwift

class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        // Configure keyboard manager
        let manager = IQKeyboardManager.sharedManager()
        manager.enable = true
        manager.enableAutoToolbar = true
        manager.shouldResignOnTouchOutside = true
        
        return true
    }
}

class MyViewController: UIViewController {
    @IBOutlet weak var myView: UIView!
    
    func findViewController() {
        if let controller = myView.viewController() {
            print("Found: \(controller)")
        }
    }
}

Per-Field Customization Example

One of the powerful new features in v6 is per-field customization:
class LoginViewController: UIViewController {
    @IBOutlet weak var emailTextField: UITextField!
    @IBOutlet weak var passwordTextField: UITextField!
    @IBOutlet weak var confirmPasswordTextField: UITextField!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Password field shouldn't be navigable via Previous/Next
        passwordTextField.ignoreSwitchingByNextPrevious = true
        confirmPasswordTextField.ignoreSwitchingByNextPrevious = true
        
        // Email field always dismisses keyboard when tapping outside,
        // even if global setting is disabled
        emailTextField.shouldResignOnTouchOutsideMode = .enabled
    }
}

Benefits of v6

Cleaner API

Simplified shared instance access with shared property

Better Naming

More descriptive method names like viewContainingController()

Enhanced Customization

New placeholder color options for better theming

Granular Control

Per-field customization options for complex forms

Troubleshooting

Solution: Replace with shared:
// Old
IQKeyboardManager.sharedManager()

// New
IQKeyboardManager.shared
Solution: Use viewContainingController() instead:
// Old
view.viewController()

// New
view.viewContainingController()
Check: Ensure you have shouldShowToolbarPlaceholder enabled:
IQKeyboardManager.shared.shouldShowToolbarPlaceholder = true
IQKeyboardManager.shared.placeholderColor = .gray

Deprecation Warnings

If you see deprecation warnings in v6, they’re likely for features that will be removed in v7:
Features marked as deprecated in v6:
  • canAdjustAdditionalSafeAreaInsets (removed in v7)
  • preventShowingBottomBlankSpace (removed in v7)
  • shouldFixInteractivePopGestureRecognizer (removed in v7)
If you’re using these features, consider alternatives before upgrading to v7.

Compatibility Notes

iOS Version Support

Version 6.0 dropped support for older iOS versions. Ensure your deployment target meets the minimum requirement:
# Podfile
platform :ios, '13.0'  # Check the exact minimum in release notes

Swift Version

Version 6.0 requires Swift 5.0 or later. Ensure your project uses a compatible Swift version.

Next Steps

After successfully migrating to v6:
1

Explore New Features

Try out the new customization options like placeholderColor and placeholderButtonColor
2

Refine Per-Field Behavior

Use ignoreSwitchingByNextPrevious and shouldResignOnTouchOutsideMode for better UX
3

Plan for v7

If you eventually plan to upgrade to v7, review the v6 to v7 migration guide to understand upcoming changes

Need Help?

If you encounter issues:
  1. Check GitHub Issues
  2. Review the v6 release notes
  3. Ask in Stack Overflow with the iqkeyboardmanager tag
Simple Migration: The v5 to v6 migration is one of the simplest in IQKeyboardManager’s history. Most apps can complete it in under 30 minutes.

Build docs developers (and LLMs) love