Comments (3)
I actually tried a similar method earlier, but got an error because i didn't add a delay for the rendering. This will solve for now, thanks!
from svpinview.
There is a way in which you can do this, although it's a little ugly.
The didChangeCallback gives you the pin that has been entered so far, this can be stored on the presenting layer (ViewController). You can then set the error styling, call clearPin() and follow it up by pasting the partial (or complete) pin using the pastePin method.
The pasting will have to be delayed by a small offset in order for the view to have time to render itself before the pin is copied (hence ugly 😅).
pinView.didChangeCallback = { pin in
self.tempPinStore = pin
print("The entered pin is \(pin)")
}
// toggle error state
pinView.textColor = .red
pinView.activeBorderLineColor = .red
pinView.borderLineColor = .red
pinView.becomeFirstResponderAtIndex = tempPinStore.count
clearPin()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.pinView.pastePin(pin: self.tempPinStore)
}
Thanks for sharing your use-case, will try and improve on the way this is handled.
Do let me know if this resolves your problem.
from svpinview.
@kosakoytim
I have added a completionHandler for the clearPin method in the latest release.
from svpinview.
Related Issues (20)
- didFinishCallback is not reachable from Objective-C Project HOT 1
- Autofill doesn't work at iPhone 6s - iOS 13.7 HOT 5
- Pinview shows "xx pasted from yy" notification on entering pin HOT 9
- Crash while opening SVPinCell HOT 3
- pastePin -> after pasting pin in SVPinView. Text is not showing in view
- Error border color not available
- Keyboard Hidden
- Height of Pinview
- Only 5 pins appear on iPhone 12 pro max, even if pinLength is 6 HOT 2
- Package.swift Not Found HOT 1
- XCode 13 support.
- PinView crashes on iPhone SE 2nd Generation HOT 2
- ERR-103: Type Mismatch HOT 1
- Uppercase HOT 1
- alignment
- ShouldSecureText Works on the new characters typed but not on the old one.
- How can set keyboard hide when user tap on first field
- bug is I type 1, 2, 3 and cursor go to 4 potion and click back than it's go to 3 potion and text is already exist (3) and i press 4 then it's replacing 3 potion digit so out put like 124.
- Cursor issue
- first pin border disActive borderColor didn't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svpinview.