KeyboardHideManager - codeless manager to hide keyboard by tapping on views for iOS written in Swift.
pod 'KeyboardHideManager', '~> 1.0'
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate KeyboardHideManager into your Xcode project using CocoaPods, create file
Podfile with content:
platform :ios, '9.0' use_frameworks! target '<Your Target Name>' do pod 'KeyboardHideManager', '~> 1.0' end
Then, run the following command:
$ pod install
Close 'Your Target Name'.xcodeproj and open 'Your Target Name'.xcworkspace.
KeyboardHideManager cannot be used with Carthage in IB due
.framework issue. Use CocoaPods or Manual install.
If you prefer not to use either of the aforementioned dependency managers, you can integrate KeyboardHideManager into your project manually.
KeyboardHideManager folder in your project.
KeyboardHideManagerin Class field
Target must be
UIView subclass and
user iteraction enabled is on. You can set it in IB in View section: (example for UILabel)
or in code:
someView.isUserInteractionEnabled = true
To use with xib you must add strong property to controller:
var keyboardHideManager: KeyboardHideManager!
Otherwise it will be deinited. It is logic of Objects in xibs.
KeyboardHideManager is released under the MIT license. See LICENSE for details.