Comments (5)
Hi @bhavitha-fission, I have yet to provide support for SwiftUI. Will work on this soon - please stay tuned. Thanks.
from svpinview.
+1 also need it in Swift UI
from svpinview.
import SwiftUI
import SVPinView
import UIKit
struct OTPWithKAPin: UIViewRepresentable {
var otpCode: String?
var numberofElement: Int = 6
var getotp : (_ code: String) -> ()
class Coordinator: NSObject {
var parent: OTPWithKAPin
init(_ parent: OTPWithKAPin) {
self.parent = parent
}
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeUIView(context: Context) -> SVPinView {
let pinView:SVPinView = SVPinView()
pinView.pinLength = numberofElement
pinView.secureCharacter = "\u{25CF}"
pinView.interSpace = CGFloat(numberofElement)
pinView.textColor = UIColor.black
pinView.shouldSecureText = true
pinView.style = .underline
pinView.borderLineColor = UIColor(named: "TintColor")!.withAlphaComponent(0.50)
pinView.activeBorderLineColor = UIColor(named: "TintColor")!.withAlphaComponent(1.0)
pinView.borderLineThickness = 1
pinView.activeBorderLineThickness = 3
pinView.font = UIFont.systemFont(ofSize: 15)
pinView.keyboardType = .phonePad
pinView.keyboardAppearance = .default
pinView.placeholder = "******"
pinView.isContentTypeOneTimeCode = true
pinView.updateFocusIfNeeded()
pinView.becomeFirstResponderAtIndex = 0
pinView.didFinishCallback = { pin in
print("The pin entered is \(pin)")
}
pinView.didChangeCallback = { pin in
self.getotp(pin)
}
return pinView
}
func updateUIView(_ uiView: SVPinView, context: Context) {
}
}
And use this with your swiftui
OTPWithKAPin(numberofElement: 4) { (pin) in
print(pin)
}
from svpinview.
Hi @bhavitha-fission, I have yet to provide support for SwiftUI. Will work on this soon - please stay tuned. Thanks.
Hi, Any update on this?
from svpinview.
@bhavitha-fission I'm working on it. Will be a little while before I have this up and working on SwiftUI. Please stay tuned.
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.