Code Monkey home page Code Monkey logo

Comments (5)

xornorik avatar xornorik commented on August 27, 2024 1

Hi @bhavitha-fission, I have yet to provide support for SwiftUI. Will work on this soon - please stay tuned. Thanks.

from svpinview.

ArkInnovationsPH avatar ArkInnovationsPH commented on August 27, 2024 1

+1 also need it in Swift UI

from svpinview.

codetanmoy avatar codetanmoy commented on August 27, 2024 1

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.

bhavitha-fission avatar bhavitha-fission commented on August 27, 2024

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.

xornorik avatar xornorik commented on August 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.