To run the example project, clone the repo, and run pod install
from the Example directory first.
IQTextInputViewNotification is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'IQTextInputViewNotification'
To observe textInputView becomeFirstResponder and resignFirstResponder changes, subscribe to the textInputView events:-
import IQTextInputViewNotification
class ViewController: UIViewController {
private let textInputViewObserver: IQTextInputViewNotification = .init()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Subscribe
textInputViewObserver.subscribe(identifier: "YOUR_UNIQUE_IDENTIFIER") {info in
print(info.event.name) // BeginEditing or EndEditing event
print(info.textInputView) // TextInputView which begin editing or end editing
// Write your own logic here based on event
}
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
// Unsubscribe
textInputViewObserver.unsubscribe(identifier: "YOUR_UNIQUE_IDENTIFIER")
}
}
Iftekhar Qurashi hack.iftekhar@gmail.com
IQTextInputViewNotification is available under the MIT license. See the LICENSE file for more info.