Skip to content

Commit b86b3b9

Browse files
author
Sergey Kovalenko
committed
Send actions for editingChanged event
1 parent 75c3a9a commit b86b3b9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Example/iOS Example/ViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,17 @@ private extension ViewController {
9090
sumInputField.tintColor = ColorConstants.gray
9191

9292
sumInputField.textInputDelegates.add(delegate: self)
93+
sumInputField.addTarget(self, action: #selector(textDidChange), for: .editingChanged)
9394
sumInputField.defaultTextAttributes = [
9495
NSAttributedStringKey.foregroundColor.rawValue: UIColor.white,
9596
NSAttributedStringKey.font.rawValue: UIFont.systemFont(ofSize: 22, weight: .regular)]
9697
sumInputField.addAttributes([.foregroundColor : ColorConstants.yellow], range: NSRange(location: 0, length: 2))
9798
}
99+
100+
@objc
101+
func textDidChange(_ field: UITextField) {
102+
print("textDidChange \(field)")
103+
}
98104

99105
func configureTextView() {
100106
configureCardNumberView()

Source/TextInput/TextInputField/TextInputField.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import UIKit
1111
open class TextInputField: AttributedTextInputField, TextInput {
1212
// MARK: - TextInput
1313
open var content: String? {
14-
set { super.text = newValue }
14+
set {
15+
super.text = newValue
16+
sendActions(for: .editingChanged)
17+
}
1518
get { return super.text }
1619
}
1720

0 commit comments

Comments
 (0)