Skip to content

Commit 3061efc

Browse files
committed
Fixed delete backward issue for empty field
1 parent d5f9e64 commit 3061efc

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Added support for Swift 4 and auto highlight for first field on loading the view
5656

5757
Added support for error border color when invalid OTP is entered.
5858

59+
### Version 1.1.3
60+
61+
Fixed delete backward issue when field is empty.
62+
5963

6064
## License
6165
MIT License

VPMOTPView/VPMOTPTextField.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// VPMOTPTextField.swift
33
// VPMOTPView
4-
// Version 1.1.2
4+
// Version 1.1.3
55
//
66
// Created by Varun P M on 14/12/16.
77
// Copyright © 2016 Varun P M. All rights reserved.
@@ -74,6 +74,12 @@ class VPMOTPTextField: UITextField {
7474
textAlignment = .center
7575
}
7676

77+
override func deleteBackward() {
78+
super.deleteBackward()
79+
80+
_ = delegate?.textField?(self, shouldChangeCharactersIn: NSMakeRange(0, 0), replacementString: "")
81+
}
82+
7783
// Helper function to create diamond view
7884
fileprivate func addDiamondMask() {
7985
let path = UIBezierPath()

VPMOTPView/VPMOTPView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// VPMOTPView.swift
33
// VPMOTPView
4-
// Version 1.1.2
4+
// Version 1.1.3
55
//
66
// Created by Varun P M on 14/12/16.
77
// Copyright © 2016 Varun P M. All rights reserved.

0 commit comments

Comments
 (0)