Swiftpack.co - Package - alexpiezo/PinEntryView

PinEntryView

Preview

Usage


import PinEntryView

struct ContentView: View {
    @State var isFirstResponder:Bool = false
    @State var pinText = ""
    
    var body: some View {
        VStack{            
            PinEntryView(text: $pinText, numberOfDigits: 6, spacing: 10, isFirstResponder: $isFirstResponder, onComplete: { (code) in
                self.isFirstResponder = false
            }) { (string, selected, enabled) in
                
                //Create item view 
                Text("\(string ?? "_")")
                .foregroundColor( Color.black)
                .frame(width: 30, height: 30)
                    .background(selected ? Color.clear : Color.gray)
                .border( Color.black, width: 1)
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Github

link
Stars: 0

Dependencies

Used By

Total: 0