Skip to content

Commit

Permalink
- Reverting changes made to fix #21
Browse files Browse the repository at this point in the history
- This fixes #25
  • Loading branch information
xornorik committed Mar 20, 2019
1 parent 724cc7c commit c70eb44
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SVPinView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Pod::Spec.new do |s|

s.name = "SVPinView"
s.version = "1.0.6"
s.version = "1.0.7"
s.summary = "SVPinView is a customisable library used for accepting alphanumeric pins or one-time passwords."

s.homepage = "https://github.com/xornorik/SVPinView"
Expand Down
Binary file not shown.
13 changes: 7 additions & 6 deletions SVPinView/Source/Classes/SVPinView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ public class SVPinView: UIView {
collectionView.register(collectionViewNib, forCellWithReuseIdentifier: reuseIdentifier)
flowLayout.scrollDirection = .vertical //weird!!!
collectionView.isScrollEnabled = false

password = [String](repeating: "", count: pinLength)


self.addSubview(view)
view.frame = bounds
view.autoresizingMask = [UIView.AutoresizingMask.flexibleWidth, UIView.AutoresizingMask.flexibleHeight]
Expand Down Expand Up @@ -150,8 +148,12 @@ public class SVPinView: UIView {
// store text
let text = textField.text ?? ""
let passwordIndex = index - 1
// delete if space
password[passwordIndex] = text == " " ? "" : text
if password.count > (passwordIndex) {
// delete if space
password[passwordIndex] = text == " " ? "" : text
} else {
password.append(text)
}
validateAndSendCallback()
}

Expand Down Expand Up @@ -215,7 +217,6 @@ public class SVPinView: UIView {
public func getPin() -> String {

guard !isLoading else { return "" }
print("~~~~\(password)")
guard password.count == pinLength && password.joined().trimmingCharacters(in: CharacterSet(charactersIn: " ")).count == pinLength else {
return ""
}
Expand Down

0 comments on commit c70eb44

Please sign in to comment.