IQKeyboardManager Documentation

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any...

16,622 stars Swift Swift 1 file ยท ~8,025 tokens #iqkeyboardmanager#keyboard#objective-c#swift#xcode
RAW Doc

File: README.md



IQKeyboardManager Objective-C version source code is moved to https://github.com/hackiftekhar/IQKeyboardManagerObjC

Introduction

While developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the UITextField/UITextView. IQKeyboardManager allows you to prevent this issue of keyboard sliding up and covering UITextField/UITextView without needing you to write any code or make any additional setup. To use IQKeyboardManager you simply need to add source files to your project.

Key Features

  1. One Line of Code - Just enable and it works
  2. Works Automatically - No manual setup required
  3. No More UIScrollView - Automatically handles scroll views
  4. No More Subclasses - Works with standard UIKit components
  5. No More Manual Work - Handles all edge cases automatically
  6. Modular Architecture - Include only what you need via subspecs

What's Included

  • โœ… Automatic keyboard avoidance for UITextField/UITextView
  • โœ… Support for UIScrollView, UITableView, UICollectionView
  • โœ… All interface orientations
  • โœ… Configurable keyboard distance
  • โœ… Class-level enable/disable control

Optional Features (via Subspecs)

  • ๐Ÿ“ฆ Toolbar with Previous/Next/Done buttons
  • ๐Ÿ“ฆ Return key handling customization
  • ๐Ÿ“ฆ Tap-to-resign keyboard
  • ๐Ÿ“ฆ Keyboard appearance configuration
  • ๐Ÿ“ฆ UITextView with placeholder supportv

Subspecs

Now IQKeyboardManagerSwift uses a modular architecture with subspecs.
By default, all subspecs are included, but you can include only what you need:

Available Subspecs

  • Core (always included): Basic keyboard distance management
  • Appearance: Keyboard appearance configuration
  • IQKeyboardReturnManager: Return key handling
  • IQKeyboardToolbarManager: Toolbar functionality (Previous/Next/Done buttons)
  • IQTextView: UITextView with placeholder support
  • Resign: Tap-to-resign keyboard functionality

Including Specific Subspecs

ruby
# Include toolbar example
pod 'IQKeyboardManagerSwift/IQKeyboardToolbarManager'

Screenshot





GIF animation

Video

Tutorial video by @rebeloper ([#1135](https://github.com/hackiftekhar/IQKeyboardManager/issues/1135))

@rebeloper demonstrated two videos on how to implement IQKeyboardManager at it's core:

https://www.youtube.com/playlist?list=PL_csAAO9PQ8aTL87XnueOXi3RpWE2m_8v

Warning

  • If you're planning to build SDK/library/framework and want to handle UITextField/UITextView with IQKeyboardManager then you're totally going the wrong way. I would never suggest to add IQKeyboardManager as dependency/adding/shipping with any third-party library. Instead of adding IQKeyboardManager you should implement your own solution to achieve same kind of results. IQKeyboardManager is totally designed for projects to help developers for their convenience, it's not designed for adding/dependency/shipping with any third-party library, because doing this could block adoption by other developers for their projects as well (who are not using IQKeyboardManager and have implemented their custom solution to handle UITextField/UITextView in the project).
  • If IQKeyboardManager conflicts with other third-party library, then it's developer responsibility to enable/disable IQKeyboardManager when presenting/dismissing third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.

Requirements

Minimum iOS Target Minimum Xcode Version
IQKeyboardManagerSwift iOS 13.0 Xcode 13
Demo Project Xcode 15

Swift versions support

Swift Xcode IQKeyboardManagerSwift
5.9, 5.8, 5.7 16 >= 7.0.0
5.9, 5.8, 5.7, 5.6 15 >= 7.0.0
5.5, 5.4, 5.3, 5.2, 5.1, 5.0, 4.2 11 >= 6.5.7
5.1, 5.0, 4.2, 4.0, 3.2, 3.0 11 >= 6.5.0
5.0,4.2, 4.0, 3.2, 3.0 10.2 >= 6.2.1
4.2, 4.0, 3.2, 3.0 10.0 >= 6.0.4
4.0, 3.2, 3.0 9.0 5.0.0

Installation

CocoaPods

To install it, simply add the following line to your Podfile: (#236)

ruby
pod 'IQKeyboardManagerSwift'

Or you can choose the version you need based on Swift support table from Requirements

ruby
pod 'IQKeyboardManagerSwift', '8.0.0'

Carthage

To integrate IQKeyboardManger or IQKeyboardManagerSwift into your Xcode project using Carthage, add the following line to your Cartfile:

ogdl
github "hackiftekhar/IQKeyboardManager"

Run carthage update --use-xcframeworks to build the frameworks and drag IQKeyboardManagerSwift.xcframework into your Xcode project based on your need. Make sure to add only one framework, not both.

Swift Package Manager (SPM)

To install IQKeyboardManagerSwift package via Xcode

Source Code

IQKeyboardManagerSwift: Source code installation is not supported (since 7.2.0) because now the library depends on some other independent libraries. Due to this you may face compilation issues.

Basic Usage

Minimal Setup (Core Only)

In AppDelegate.swift, import and enable IQKeyboardManager:

swift
import IQKeyboardManagerSwift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, 
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Enable keyboard management
        IQKeyboardManager.shared.isEnabled = true

        return true
    }
}

That's it! The keyboard will now automatically adjust to avoid covering text fields.

With Toolbar (Requires IQKeyboardToolbarManager Subspec)

swift
import IQKeyboardManagerSwift

func application(_ application: UIApplication, 
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // Enable keyboard management
    IQKeyboardManager.shared.isEnabled = true
    
    // Enable toolbar (@Deprecated: Please use IQKeyboardToolbarManager pod independently)
    IQKeyboardManager.shared.enableAutoToolbar = true

    return true
}

With All Features

swift
import IQKeyboardManagerSwift

func application(_ application: UIApplication, 
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // Core functionality
    IQKeyboardManager.shared.isEnabled = true
    IQKeyboardManager.shared.keyboardDistance = 20.0
    
    // Toolbar (if using IQKeyboardToolbarManager subspec)
    IQKeyboardManager.shared.enableAutoToolbar = true
    
    // Tap to resign (if using Resign subspec)
    IQKeyboardManager.shared.resignOnTouchOutside = true
    
    // Appearance (if using Appearance subspec)
    IQKeyboardManager.shared.keyboardConfiguration.overrideKeyboardAppearance = true
    IQKeyboardManager.shared.keyboardConfiguration.keyboardAppearance = .dark

    return true
}

Migration Guide

Dependency Diagram

LICENSE

Distributed under the MIT License.

Contributions

Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.

Author

If you wish to contact me, email at: [email protected]


File: Documentation/MIGRATION GUIDE 1.0 TO 2.0.md

IQKeyboardManager MIGRATION GUIDE 1.0 TO 2.0

1. Class Name changed

Old class name

objc
@interface IQKeyBoardManager : NSObject {
    //...
}

New Class Name

objc
@interface IQKeyboardManager : NSObject {
    //...
}

2. Function name changes

Old function and property names

objc
+(void)installKeyboardManager;
+(void)setTextFieldDistanceFromKeyboard:(CGFloat)distance;
+(void)enableKeyboardManger;
+(void)disableKeyboardManager;

New function and property names

objc
+ (IQKeyboardManager*)sharedManager;
@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField;
@property(nonatomic, assign, getter = isEnabled) BOOL enable;

3. New features

IQKeyboardManager

objc
@property(nonatomic, assign, getter = isEnableAutoToolbar) BOOL enableAutoToolbar;
@property(nonatomic, assign) IQAutoToolbarManageBehaviour toolbarManageBehaviour;
- (void)resignFirstResponder;
  • Cocoapods support added

UIVIew Category

objc
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction;

File: Documentation/MIGRATION GUIDE 2.0 TO 3.0.md

IQKeyboardManager MIGRATION GUIDE 2.0 TO 3.0

1. New features

IQKeyboardManager

objc
@property(nonatomic, assign) BOOL shouldResignOnTouchOutside;
@property(nonatomic, assign) BOOL shouldShowTextFieldPlaceholder;
@property(nonatomic, assign) BOOL canAdjustTextView;
  • Cocoapods support added

UIVIew Category

objc
- (void)addDoneOnKeyboardWithTarget:(id)target action:(SEL)action shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addCancelDoneOnKeyboardWithTarget:(id)target cancelAction:(SEL)cancelAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder;
- (void)addPreviousNextDoneOnKeyboardWithTarget:(id)target previousAction:(SEL)previousAction nextAction:(SEL)nextAction doneAction:(SEL)doneAction shouldShowPlaceholder:(BOOL)showPlaceholder;

File: Documentation/MIGRATION GUIDE 3.0 TO 4.0.md

IQKeyboardManager MIGRATION GUIDE 3.0 TO 4.0

1. New features

New Class

objc
@interface IQKeyboardReturnKeyHandler : NSObject {
    //...
}
-(nonnull instancetype)initWithViewController:(nullable UIViewController*)controller
@property(nullable, nonatomic, weak) id delegate;
@property(nonatomic, assign) UIReturnKeyType lastTextFieldReturnKeyType;
-(void)addTextFieldView:(nonnull UIView*)textFieldView;
-(void)removeTextFieldView:(nonnull UIView*)textFieldView;
-(void)addResponderFromView:(nonnull UIView*)view;
-(void)removeResponderFromView:(nonnull UIView*)view;
@end

New Class

objc
@interface IQTextView : UITextView
@property(nullable, nonatomic,copy)   NSString    *placeholder;
@end

IQKeyboardManager

objc
@property(nonatomic, assign) BOOL preventShowingBottomBlankSpace;
@property(nonatomic, assign) BOOL shouldToolbarUsesTextFieldTintColor;
@property(nullable, nonatomic, strong) UIColor *toolbarTintColor;
@property(nullable, nonatomic, strong) UIImage *toolbarDoneBarButtonItemImage;
@property(nullable, nonatomic, strong) NSString *toolbarDoneBarButtonItemText;
@property(nonatomic, assign) BOOL shouldShowTextFieldPlaceholder;
@property(nullable, nonatomic, strong) UIFont *placeholderFont;
@property(nonatomic, assign) BOOL shouldFixTextViewClip;
@property(nonatomic, assign) BOOL overrideKeyboardAppearance;
@property(nonatomic, assign) UIKeyboardAppearance keyboardAppearance;
@property (nonatomic, readonly) BOOL canGoPrevious;
@property (nonatomic, readonly) BOOL canGoNext;
@property(nonatomic, assign) BOOL shouldPlayInputClicks;
@property(nonatomic, assign) BOOL shouldAdoptDefaultKeyboardAnimation;
@property(nonatomic, assign) BOOL layoutIfNeededOnUpdate;
- (BOOL)goPrevious;
- (BOOL)goNext;
-(void)disableDistanceHandlingInViewControllerClass:(nonnull Class)disabledClass;
-(void)removeDisableDistanceHandlingInViewControllerClass:(nonnull Class)disabledClass;
-( NSSet* _Nonnull )disabledInViewControllerClasses;
-(void)disableToolbarInViewControllerClass:(nonnull Class)toolbarDisabledClass;
-(void)removeDisableToolbarInViewControllerClass:(nonnull Class)toolbarDisabledClass;
-( NSSet* _Nonnull )disabledToolbarInViewControllerClasses;
-(void)considerToolbarPreviousNextInViewClass:(nonnull Class)toolbarPreviousNextConsideredClass;
-(void)removeConsiderToolbarPreviousNextInViewClass:(nonnull Class)toolbarPreviousNextConsideredClass;
-(NSSet* _Nonnull)consideredToolbarPreviousNextViewClasses;

UIVIew Category

objc
@property (assign, nonatomic) BOOL shouldHideTitle;
-(void)setCustomPreviousTarget:(nullable id)target action:(nullable SEL)action;
-(void)setCustomNextTarget:(nullable id)target action:(nullable SEL)action;
-(void)setCustomDoneTarget:(nullable id)target action:(nullable SEL)action;
- (void)addRightButtonOnKeyboardWithImage:(nullable UIImage*)image target:(nullable id)target action:(nullable SEL)action titleText:(nullable NSString*)titleText;
- (void)addCancelDoneOnKeyboardWithTarget:(nullable id)target cancelAction:(nullable SEL)cancelAction doneAction:(nullable SEL)doneAction titleText:(nullable NSString*)titleText;
- (void)addLeftRightOnKeyboardWithTarget:(nullable id)target leftButtonTitle:(nullable NSString*)leftButtonTitle rightButtonTitle:(nullable NSString*)rightButtonTitle leftButtonAction:(nullable SEL)leftButtonAction rightButtonAction:(nullable SEL)rightButtonAction titleText:(nullable NSString*)titleText;
- (void)addPreviousNextDoneOnKeyboardWithTarget:(nullable id)target previousAction:(nullable SEL)previousAction nextAction:(nullable SEL)nextAction doneAction:(nullable SEL)doneAction titleText:(nullable NSString*)titleText;
- (void)addPreviousNextRightOnKeyboardWithTarget:(nullable id)target rightButtonTitle:(nullable NSString*)rightButtonTitle previousAction:(nullable SEL)previousAction nextAction:(nullable SEL)nextAction rightButtonAction:(nullable SEL)rightButtonAction titleText:(nullable NSString*)titleText;

UIVIew Category

objc
@property (nonatomic, readonly) BOOL isAskingCanBecomeFirstResponder;
@property (nullable, nonatomic, readonly, strong) UIViewController *viewController;
@property (nullable, nonatomic, readonly, strong) UIViewController *topMostController;
-(nullable UIView*)superviewOfClassType:(nonnull Class)classType;
@property (nonatomic, getter=isSearchBarTextField, readonly) BOOL searchBarTextField;
@property (nonatomic, getter=isAlertViewTextField, readonly) BOOL alertViewTextField;
-(CGAffineTransform)convertTransformToView:(nullable UIView*)toView;

UIScrollView Category

objc
@property(nonatomic, assign) BOOL shouldRestoreScrollViewContentOffset;

UIView Category (For UITextField and UITextView)

objc
@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField;

UIViewController Category

objc
@property(nullable, nonatomic, strong) IBOutlet NSLayoutConstraint *IQLayoutGuideConstraint;

Swift version added


File: Documentation/MIGRATION GUIDE 4.0 TO 5.0.md

IQKeyboardManager MIGRATION GUIDE 4.0 TO 5.0

1. Removed UIView Category features

swift
public var isAskingCanBecomeFirstResponder: Bool // This is not necessary now

1. Removed IQKeyboardManager features

swift
public var shouldFixTextViewClip = true // These are internally handled, so no more needed
public var canAdjustTextView = false // These are internally handled, so no more needed
public var shouldAdoptDefaultKeyboardAnimation = true   // This no longer needed

2. IQKeyboardManager functions

Old IQKeyboardManager functions

swift
public func disableDistanceHandlingInViewControllerClass(disabledClass : AnyClass)
public func removeDisableDistanceHandlingInViewControllerClass(disabledClass : AnyClass)
public func disabledInViewControllerClassesString() -> Set<String>
public func disableToolbarInViewControllerClass(toolbarDisabledClass : AnyClass)
public func removeDisableToolbarInViewControllerClass(toolbarDisabledClass : AnyClass)
public func disabledToolbarInViewControllerClassesString() -> Set<String>
public func considerToolbarPreviousNextInViewClass(toolbarPreviousNextConsideredClass : AnyClass)
public func removeConsiderToolbarPreviousNextInViewClass(toolbarPreviousNextConsideredClass : AnyClass)
public func consideredToolbarPreviousNextViewClassesString() -> Set<String>

New IQKeyboardManager functions

swift
open var disabledDistanceHandlingClasses = [UIViewController.Type]()
open var enabledDistanceHandlingClasses = [UIViewController.Type]()
open var disabledToolbarClasses = [UIViewController.Type]()
open var enabledToolbarClasses = [UIViewController.Type]()
open var toolbarPreviousNextAllowedClasses = [UIView.Type]()
open var disabledTouchResignedClasses = [UIViewController.Type]()
open var enabledTouchResignedClasses = [UIViewController.Type]()
open var touchResignedGestureIgnoreClasses = [UIView.Type]()

3. UIView Category functions

Old UIView Category functions

swift
public var shouldHideTitle: Bool?
public var drawingPlaceholderText: String?
public func setCustomPreviousTarget(target: AnyObject?, selector: Selector?)
public func setCustomNextTarget(target: AnyObject?, selector: Selector?)

New UIView Category functions

swift
public var shouldHidePlaceholderText: Bool
public var keyboardToolbar: IQToolbar
public var shouldHideToolbarPlaceholder: Bool
public var drawingToolbarPlaceholder: String?
open func setTarget(_ target: AnyObject?, action: Selector?) // in IQBarButtonItem

4. New features

IQKeyboardManager

swift
open var toolbarBarTintColor : UIColor?
open var keyboardShowing: Bool
open var movedDistance: CGFloat
open var enableDebugging = false
open var shouldFixInteractivePopGestureRecognizer = true
open var previousNextDisplayMode = IQPreviousNextDisplayMode.Default
open func reloadInputViews()
open func reloadLayoutIfNeeded()
open func registerAllNotifications()
open func registerTextFieldViewClass(_ aClass: UIView.Type, didBeginEditingNotificationName : String, didEndEditingNotificationName : String)
open func unregisterTextFieldViewClass(_ aClass: UIView.Type, didBeginEditingNotificationName : String, didEndEditingNotificationName : String)

UIScrollView Category

swift
public var shouldIgnoreScrollingAdjustment: Bool

File: Documentation/MIGRATION GUIDE 5.0 TO 6.0.md

IQKeyboardManager MIGRATION GUIDE 5.0 TO 6.0

1. IQKeyboardManager functions

Old IQKeyboardManager functions

swift
open class func sharedManager() -> IQKeyboardManager
@objc public class var shared: IQKeyboardManager

New IQKeyboardManager functions

swift

2. UIView Category functions

Old UIView Category functions

swift
public func viewController()->UIViewController?

New UIView Category functions

swift
@objc public func viewContainingController()->UIViewController?

3. New features

IQKeyboardManager

swift
@objc public var placeholderColor: UIColor?
@objc public var placeholderButtonColor: UIColor?
@objc public var canAdjustAdditionalSafeAreaInsets = false

UIView Category functions

swift
@objc public var ignoreSwitchingByNextPrevious: Bool
@objc public var shouldResignOnTouchOutsideMode: IQEnableMode
@objc public func parentContainerViewController()->UIViewController?

File: Documentation/MIGRATION GUIDE 6.0 TO 7.0.md

IQKeyboardManager MIGRATION GUIDE 6.0 TO 7.0

1. Removed IQKeyboardManager functions

swift
@objc public var preventShowingBottomBlankSpace = true
@objc public var shouldFixInteractivePopGestureRecognizer = true
@objc public var canAdjustAdditionalSafeAreaInsets = false
@objc func registerTextFieldViewClass(_ aClass: UIView.Type,
                                      didBeginEditingNotificationName: String,
                                      didEndEditingNotificationName: String)
@objc func unregisterTextFieldViewClass(_ aClass: UIView.Type,
                                        didBeginEditingNotificationName: String,
                                        didEndEditingNotificationName: String)

2. Removed UIViewController functions

swift
@IBOutlet @objc public var IQLayoutGuideConstraint: NSLayoutConstraint?

3. IQKeyboardManager functions

Old IQKeyboardManager functions

swift
@objc var shouldResignOnTouchOutside: Bool
@objc var shouldPlayInputClicks: Bool

@objc var toolbarManageBehaviour: IQAutoToolbarManageBehavior
@objc var shouldToolbarUsesTextFieldTintColor: Bool
@objc var toolbarTintColor: UIColor?
@objc var toolbarBarTintColor: UIColor?
@objc var previousNextDisplayMode: IQPreviousNextDisplayMode

@objc var toolbarPreviousBarButtonItemImage: UIImage?
@objc var toolbarPreviousBarButtonItemText: String?
@objc var toolbarPreviousBarButtonItemAccessibilityLabel: String?

@objc var toolbarNextBarButtonItemImage: UIImage?
@objc var toolbarNextBarButtonItemText: String?
@objc var toolbarNextBarButtonItemAccessibilityLabel: String?

@objc var toolbarDoneBarButtonItemImage: UIImage?
@objc var toolbarDoneBarButtonItemText: String?
@objc var toolbarDoneBarButtonItemAccessibilityLabel: String?

@objc var toolbarTitlBarButtonItemAccessibilityLabel: String?
@objc var shouldShowToolbarPlaceholder: Bool
@objc var placeholderFont: UIFont?
@objc var placeholderColor: UIColor?
@objc var placeholderButtonColor: UIColor?

@objc var overrideKeyboardAppearance: Bool
@objc var keyboardAppearance: UIKeyboardAppearance

@objc func registerKeyboardSizeChange(identifier: AnyHashable, sizeHandler: @escaping SizeBlock)
@objc func unregisterKeyboardSizeChange(identifier: AnyHashable) {}   
@objc var keyboardShowing: Bool
@objc var keyboardFrame: CGRect

New IQKeyboardManager functions

text
/* Detailed source-code truncated for AI context efficiency. */

1. UIScrollView extension functions

Old functions

swift
var shouldIgnoreScrollingAdjustment: Bool
var shouldIgnoreContentInsetAdjustment: Bool
var shouldRestoreScrollViewContentOffset: Bool

New functions

swift
var iq: IQKeyboardManagerWrapper
/*
iq.ignoreScrollingAdjustment
iq.ignoreContentInsetAdjustment
iq.restoreContentOffset
*/

1. UIView extension functions

Old functions

swift
var keyboardDistanceFromTextField: CGFloat
var ignoreSwitchingByNextPrevious: Bool
var enableMode: IQEnableMode
var shouldResignOnTouchOutsideMode: IQEnableMode

New functions

swift
var iq: IQKeyboardManagerWrapper
/*
iq.distanceFromKeyboard
iq.ignoreSwitchingByNextPrevious
iq.enableMode
iq.resignOnTouchOutsideMode
*/

2. UIView extension functions

Old UIView extension functions

swift
func viewContainingController() -> UIViewController?
func topMostController() -> UIViewController?
func parentContainerViewController() -> UIViewController?
func superviewOfClassType(_ classType: UIView.Type, belowView: UIView? = nil) -> UIView?

New UIView extension functions

swift
var iq: IQKeyboardManagerWrapper
/*
iq.viewContainingController()
iq.topMostController()
iq.parentContainerViewController()
iq.superviewOf(type:belowView:)
*/

2. UIView extension functions

Old UIView extension functions

swift
var keyboardToolbar: IQToolbar
var shouldHideToolbarPlaceholder: Bool
var toolbarPlaceholder: String?
var drawingToolbarPlaceholder: String?
func addKeyboardToolbarWithTarget(target: AnyObject?,
                                  titleText: String?,
                                  titleAccessibilityLabel: String? = nil,
                                  rightBarButtonConfiguration: IQBarButtonItemConfiguration?,
                                  previousBarButtonConfiguration: IQBarButtonItemConfiguration? = nil,
                                  nextBarButtonConfiguration: IQBarButtonItemConfiguration? = nil)

New UIView extension functions

swift
var iq: IQKeyboardManagerWrapper
/*
iq.toolbar
iq.hidePlaceholder
iq.placeholder
iq.drawingPlaceholder
iq.addToolbar(target:previousConfiguration:nextConfiguration:rightConfiguration:title:titleAccessibilityLabel:)
*/

2. UIViewController extension functions

Old UIViewController extension functions

swift
open func parentIQContainerViewController() -> UIViewController?

New UIViewController extension functions

swift
open func iq_parentContainerViewController() -> UIViewController?

3. New features

IQKeyboardManager

swift

UIView Category functions

swift
@property(nonatomic, assign) BOOL shouldIgnoreContentInsetAdjustment;
@property(nonatomic, assign) IQEnableMode enableMode;

UIViewController functions

swift
-(nullable UIViewController*)parentIQContainerViewController;

File: Documentation/MIGRATION GUIDE 7.0 TO 8.0.md

IQKeyboardManager MIGRATION GUIDE 7.0 TO 8.0

Keyboard Toolbar

IQKeyboardManager.shared.enableAutoToolbar is now default to false. Actually it's now part of the IQKeyboardToolbarManager library. Due to this change, you may not see the toolbar over keyboard.

  • Solution 1: Either Add IQKeyboardManager.shared.enableAutoToolbar = true in your app delegate
  • Solution 2: Or Use IQKeyboardToolbarManager directly to enable keyboard toolbar using IQKeyboardToolbarManager.shared.isEnabled = true

1. Features removed (Moved to their own independent libraries)

  • All features related to toolbar handling has been moved to IQKeyboardToolbarManager Link
  • IQKeyboardListener Link (Renamed to IQKeyboardNotification)
  • IQTextFieldViewListener Link (Renamed to IQTextInputViewNotification)
  • IQReturnKeyHandler Link (Renamed to IQKeyboardReturnManager)
  • IQKeyboardToolbar Link
  • IQTextView Link

2. Features moved to IQKeyboardToolbarManager

  • IQPreviousNextView class (Renamed to IQDeepResponderContainerView)
    If you are using IQPreviousNextView in your storyboard then you have to change the class to IQDeepResponderContainerView and also have to change the module to IQKeyboardToolbarManager.
  • IQToolbarConfiguration class (Renamed to IQKeyboardToolbarConfiguration)
  • IQToolbarPlaceholderConfiguration class (Renamed to IQKeyboardToolbarPlaceholderConfiguration)
  • public enum IQAutoToolbarManageBehavior: Int
  • public enum IQPreviousNextDisplayMode: Int
  • IQBarButtonItemConfiguration class
swift
// These were part of IQKeyboardManager
var enableAutoToolbar: Bool (Renamed to `isEnabled`)
var toolbarConfiguration: IQToolbarConfiguration
var playInputClicks: Bool
var disabledToolbarClasses: [UIViewController.Type]
var enabledToolbarClasses: [UIViewController.Type]
var deepResponderAllowedContainerClasses: [UIView.Type]
var canGoPrevious: Bool
var canGoNext: Bool
func goPrevious() -> Bool
func goNext() -> Bool
func reloadInputViews()
swift
// UITextField/UITextView extensions, This can be used like textField.iq.ignoreSwitchingByNextPrevious = true
var ignoreSwitchingByNextPrevious: Bool

3. Features moved to IQKeyboardToolbar

  • IQToolbar class (Renamed to IQKeyboardToolbar)
  • IQToolbarConfiguration class (Renamed to IQKeyboardToolbarConfiguration)
  • IQToolbarPlaceholderConfiguration class (Renamed to IQKeyboardToolbarPlaceholderConfiguration)
  • IQBarButtonItemConfiguration class
  • IQTitleBarButtonItem class
  • IQBarButtonItem class
  • IQInvocation class
  • IQPlaceholderable protocol
swift
// UITextField/UITextView extensions, This can be used like textField.iq.hidePlaceholder = true
var toolbar: IQToolbar
var hidePlaceholder: Bool
var placeholder: String?
var drawingPlaceholder: String?
func addToolbar(target: AnyObject?,
                    previousConfiguration: IQBarButtonItemConfiguration? = nil,
                    nextConfiguration: IQBarButtonItemConfiguration? = nil,
                    rightConfiguration: IQBarButtonItemConfiguration? = nil,
                    title: String?,
                    titleAccessibilityLabel: String? = nil)
func addDone(...)
func addRightButton(...)
func addRightLeft(...)
func addPreviousNextRight(...)
func addPreviousNextDone(...)

1. Features moved to subspecs (Cocoapods)

  • IQKeyboardManagerSwift/Appearance
swift
// IQKeyboardManager
public var overrideAppearance: Bool
public var appearance: UIKeyboardAppearance
  • IQKeyboardManagerSwift/IQKeyboardReturnManager
swift
// https://github.com/hackiftekhar/IQKeyboardReturnManager
- This subspec add `IQKeyboardReturnManager` as dependency for easier migration.
  • IQKeyboardManagerSwift/IQKeyboardToolbarManager
swift
// https://github.com/hackiftekhar/IQKeyboardToolbarManager
- This subspec add `IQKeyboardToolbarManager` as dependency for easier migration.
  • IQKeyboardManagerSwift/IQTextView
swift
// https://github.com/hackiftekhar/IQTextView
- This subspec add `IQTextView` as dependency for easier migration.
  • IQKeyboardManagerSwift/Resign
swift
// IQKeyboardManager
var resignOnTouchOutside: Bool
var resignGesture: UITapGestureRecognizer
var disabledTouchResignedClasses: [UIViewController.Type]
var enabledTouchResignedClasses: [UIViewController.Type]
var touchResignedGestureIgnoreClasses: [UIView.Type]
func resignFirstResponder() -> Bool
swift
// UITextField/UITextView extensions, This can be used like textField.iq.resignOnTouchOutsideMode = .default
var resignOnTouchOutsideMode: IQEnableMode