Contents

hackiftekhar/iqtextinputviewnotification

To run the example project, clone the repo, and run `pod install` from the Example directory first.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

IQTextInputViewNotification is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'IQTextInputViewNotification'

Usage

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")
    }
}

Author

Iftekhar Qurashi hack.iftekhar@gmail.com

Flow

[Screenshot]

License

IQTextInputViewNotification is available under the MIT license. See the LICENSE file for more info.

Package Metadata

Repository: hackiftekhar/iqtextinputviewnotification

Default branch: main

README: README.md