Skip to content

Commit

Permalink
Fixed bug with deleting backward in rx
Browse files Browse the repository at this point in the history
  • Loading branch information
arturdev committed Feb 29, 2020
1 parent 3d01b05 commit bf88bd1
Show file tree
Hide file tree
Showing 14 changed files with 921 additions and 913 deletions.
2 changes: 1 addition & 1 deletion SwiftyCodeView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|
s.swift_version = '5.0'
s.name = 'SwiftyCodeView'
s.version = '0.3.5'
s.version = '0.3.6'
s.summary = 'An UI Component for verification codes written in swift'

s.description = <<-DESC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
import UIKit

public protocol SwiftyCodeTextFieldDelegate: class {
func deleteBackward(sender: SwiftyCodeTextField)
func deleteBackward(sender: SwiftyCodeTextField, prevValue: String?)
}

open class SwiftyCodeTextField: UITextField {

weak open var deleteDelegate: SwiftyCodeTextFieldDelegate?

override open func deleteBackward() {
deleteDelegate?.deleteBackward(sender: self)
super.deleteBackward()
let prevValue = text
super.deleteBackward()
deleteDelegate?.deleteBackward(sender: self, prevValue: prevValue)
}
}
6 changes: 3 additions & 3 deletions SwiftyCodeView/Classes/SwiftyCodeView/SwiftyCodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ extension SwiftyCodeView: UITextFieldDelegate, SwiftyCodeTextFieldDelegate {
return false
}

public func deleteBackward(sender: SwiftyCodeTextField) {
for i in 1..<length{
public func deleteBackward(sender: SwiftyCodeTextField, prevValue: String?) {
for i in 1..<length {
let itemView = stackView.arrangedSubviews[i] as! SwiftyCodeItemView

if !itemView.textField.isFirstResponder {
guard itemView.textField.isFirstResponder, (prevValue?.isEmpty ?? true) else {
continue
}

Expand Down
10 changes: 5 additions & 5 deletions SwiftyCodeViewDemoRX/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PODS:
- RxRelay (5.0.0):
- RxSwift (~> 5)
- RxSwift (5.0.0)
- SwiftyCodeView/Core (0.3.3)
- SwiftyCodeView/RxSwift (0.3.3):
- SwiftyCodeView/Core (0.3.5)
- SwiftyCodeView/RxSwift (0.3.5):
- RxCocoa
- RxSwift
- SwiftyCodeView/Core
Expand All @@ -15,7 +15,7 @@ DEPENDENCIES:
- SwiftyCodeView/RxSwift (from `../`)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- RxCocoa
- RxRelay
- RxSwift
Expand All @@ -28,8 +28,8 @@ SPEC CHECKSUMS:
RxCocoa: fcf32050ac00d801f34a7f71d5e8e7f23026dcd8
RxRelay: 4f7409406a51a55cd88483f21ed898c234d60f18
RxSwift: 8b0671caa829a763bbce7271095859121cbd895f
SwiftyCodeView: 6c2b6353bba059eaa78959b8fbdc1be282b83655
SwiftyCodeView: 40aca2a0a07203113358de5cd8c24756a39bb885

PODFILE CHECKSUM: 24942d50cecea0fe9f4340842636149451c40039

COCOAPODS: 1.7.1
COCOAPODS: 1.8.4

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions SwiftyCodeViewDemoRX/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,785 changes: 893 additions & 892 deletions SwiftyCodeViewDemoRX/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf88bd1

Please sign in to comment.