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
- One Line of Code - Just enable and it works
- Works Automatically - No manual setup required
- No More UIScrollView - Automatically handles scroll views
- No More Subclasses - Works with standard UIKit components
- No More Manual Work - Handles all edge cases automatically
- 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
# 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)
pod 'IQKeyboardManagerSwift'Or you can choose the version you need based on Swift support table from Requirements
pod 'IQKeyboardManagerSwift', '8.0.0'Carthage
To integrate IQKeyboardManger or IQKeyboardManagerSwift into your Xcode project using Carthage, add the following line to your Cartfile:
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
- Go to File -> Swift Packages -> Add Package Dependency...
- Then search for https://github.com/hackiftekhar/IQKeyboardManager.git
- And choose the version you want
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:
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)
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
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
- IQKeyboardManager 2.0.0 Migration Guide
- IQKeyboardManager 3.0.0 Migration Guide
- IQKeyboardManager 4.0.0 Migration Guide
- IQKeyboardManager 5.0.0 Migration Guide
- IQKeyboardManager 6.0.0 Migration Guide
- IQKeyboardManager 7.0.0 Migration Guide
- IQKeyboardManager 8.0.0 Migration Guide
Other Links
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
@interface IQKeyBoardManager : NSObject {
//...
}New Class Name
@interface IQKeyboardManager : NSObject {
//...
}2. Function name changes
Old function and property names
+(void)installKeyboardManager;
+(void)setTextFieldDistanceFromKeyboard:(CGFloat)distance;
+(void)enableKeyboardManger;
+(void)disableKeyboardManager;New function and property names
+ (IQKeyboardManager*)sharedManager;
@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField;
@property(nonatomic, assign, getter = isEnabled) BOOL enable;3. New features
IQKeyboardManager
@property(nonatomic, assign, getter = isEnableAutoToolbar) BOOL enableAutoToolbar;
@property(nonatomic, assign) IQAutoToolbarManageBehaviour toolbarManageBehaviour;
- (void)resignFirstResponder;- Cocoapods support added
UIVIew Category
- (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
@property(nonatomic, assign) BOOL shouldResignOnTouchOutside;
@property(nonatomic, assign) BOOL shouldShowTextFieldPlaceholder;
@property(nonatomic, assign) BOOL canAdjustTextView;- Cocoapods support added
UIVIew Category
- (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
@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;
@endNew Class
@interface IQTextView : UITextView
@property(nullable, nonatomic,copy) NSString *placeholder;
@endIQKeyboardManager
@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
@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
@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
@property(nonatomic, assign) BOOL shouldRestoreScrollViewContentOffset;UIView Category (For UITextField and UITextView)
@property(nonatomic, assign) CGFloat keyboardDistanceFromTextField;UIViewController Category
@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
public var isAskingCanBecomeFirstResponder: Bool // This is not necessary now1. Removed IQKeyboardManager features
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 needed2. IQKeyboardManager functions
Old IQKeyboardManager functions
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
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
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
public var shouldHidePlaceholderText: Bool
public var keyboardToolbar: IQToolbar
public var shouldHideToolbarPlaceholder: Bool
public var drawingToolbarPlaceholder: String?
open func setTarget(_ target: AnyObject?, action: Selector?) // in IQBarButtonItem4. New features
IQKeyboardManager
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
public var shouldIgnoreScrollingAdjustment: BoolFile: Documentation/MIGRATION GUIDE 5.0 TO 6.0.md
IQKeyboardManager MIGRATION GUIDE 5.0 TO 6.0
1. IQKeyboardManager functions
Old IQKeyboardManager functions
open class func sharedManager() -> IQKeyboardManager
@objc public class var shared: IQKeyboardManagerNew IQKeyboardManager functions
2. UIView Category functions
Old UIView Category functions
public func viewController()->UIViewController?New UIView Category functions
@objc public func viewContainingController()->UIViewController?3. New features
IQKeyboardManager
@objc public var placeholderColor: UIColor?
@objc public var placeholderButtonColor: UIColor?
@objc public var canAdjustAdditionalSafeAreaInsets = falseUIView Category functions
@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
@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
@IBOutlet @objc public var IQLayoutGuideConstraint: NSLayoutConstraint?3. IQKeyboardManager functions
Old IQKeyboardManager functions
@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: CGRectNew IQKeyboardManager functions
/* Detailed source-code truncated for AI context efficiency. */1. UIScrollView extension functions
Old functions
var shouldIgnoreScrollingAdjustment: Bool
var shouldIgnoreContentInsetAdjustment: Bool
var shouldRestoreScrollViewContentOffset: BoolNew functions
var iq: IQKeyboardManagerWrapper
/*
iq.ignoreScrollingAdjustment
iq.ignoreContentInsetAdjustment
iq.restoreContentOffset
*/1. UIView extension functions
Old functions
var keyboardDistanceFromTextField: CGFloat
var ignoreSwitchingByNextPrevious: Bool
var enableMode: IQEnableMode
var shouldResignOnTouchOutsideMode: IQEnableModeNew functions
var iq: IQKeyboardManagerWrapper
/*
iq.distanceFromKeyboard
iq.ignoreSwitchingByNextPrevious
iq.enableMode
iq.resignOnTouchOutsideMode
*/2. UIView extension functions
Old UIView extension functions
func viewContainingController() -> UIViewController?
func topMostController() -> UIViewController?
func parentContainerViewController() -> UIViewController?
func superviewOfClassType(_ classType: UIView.Type, belowView: UIView? = nil) -> UIView?New UIView extension functions
var iq: IQKeyboardManagerWrapper
/*
iq.viewContainingController()
iq.topMostController()
iq.parentContainerViewController()
iq.superviewOf(type:belowView:)
*/2. UIView extension functions
Old UIView extension functions
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
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
open func parentIQContainerViewController() -> UIViewController?New UIViewController extension functions
open func iq_parentContainerViewController() -> UIViewController?3. New features
IQKeyboardManager
UIView Category functions
@property(nonatomic, assign) BOOL shouldIgnoreContentInsetAdjustment;
@property(nonatomic, assign) IQEnableMode enableMode;UIViewController functions
-(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 = truein your app delegate - Solution 2: Or Use
IQKeyboardToolbarManagerdirectly to enable keyboard toolbar usingIQKeyboardToolbarManager.shared.isEnabled = true
1. Features removed (Moved to their own independent libraries)
- All features related to toolbar handling has been moved to
IQKeyboardToolbarManagerLink IQKeyboardListenerLink (Renamed toIQKeyboardNotification)IQTextFieldViewListenerLink (Renamed toIQTextInputViewNotification)IQReturnKeyHandlerLink (Renamed toIQKeyboardReturnManager)IQKeyboardToolbarLinkIQTextViewLink
2. Features moved to IQKeyboardToolbarManager
IQPreviousNextViewclass (Renamed toIQDeepResponderContainerView)
If you are usingIQPreviousNextViewin your storyboard then you have to change the class toIQDeepResponderContainerViewand also have to change the module toIQKeyboardToolbarManager.IQToolbarConfigurationclass (Renamed toIQKeyboardToolbarConfiguration)IQToolbarPlaceholderConfigurationclass (Renamed toIQKeyboardToolbarPlaceholderConfiguration)public enum IQAutoToolbarManageBehavior: Intpublic enum IQPreviousNextDisplayMode: IntIQBarButtonItemConfigurationclass
// 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()// UITextField/UITextView extensions, This can be used like textField.iq.ignoreSwitchingByNextPrevious = true
var ignoreSwitchingByNextPrevious: Bool3. Features moved to IQKeyboardToolbar
IQToolbarclass (Renamed toIQKeyboardToolbar)IQToolbarConfigurationclass (Renamed toIQKeyboardToolbarConfiguration)IQToolbarPlaceholderConfigurationclass (Renamed toIQKeyboardToolbarPlaceholderConfiguration)IQBarButtonItemConfigurationclassIQTitleBarButtonItemclassIQBarButtonItemclassIQInvocationclassIQPlaceholderableprotocol
// 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
// IQKeyboardManager
public var overrideAppearance: Bool
public var appearance: UIKeyboardAppearanceIQKeyboardManagerSwift/IQKeyboardReturnManager
// https://github.com/hackiftekhar/IQKeyboardReturnManager
- This subspec add `IQKeyboardReturnManager` as dependency for easier migration.IQKeyboardManagerSwift/IQKeyboardToolbarManager
// https://github.com/hackiftekhar/IQKeyboardToolbarManager
- This subspec add `IQKeyboardToolbarManager` as dependency for easier migration.IQKeyboardManagerSwift/IQTextView
// https://github.com/hackiftekhar/IQTextView
- This subspec add `IQTextView` as dependency for easier migration.IQKeyboardManagerSwift/Resign
// IQKeyboardManager
var resignOnTouchOutside: Bool
var resignGesture: UITapGestureRecognizer
var disabledTouchResignedClasses: [UIViewController.Type]
var enabledTouchResignedClasses: [UIViewController.Type]
var touchResignedGestureIgnoreClasses: [UIView.Type]
func resignFirstResponder() -> Bool// UITextField/UITextView extensions, This can be used like textField.iq.resignOnTouchOutsideMode = .default
var resignOnTouchOutsideMode: IQEnableMode