GithubHelp home page GithubHelp logo

xornorik / svpinview Goto Github PK

View Code? Open in Web Editor NEW
283.0 7.0 91.0 10.75 MB

SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.

License: MIT License

Ruby 3.08% Objective-C 1.60% Swift 95.32%
pin otp passcode swift cocoapods pinview verification-code otpview otpauth otp-verification

svpinview's People

Contributors

dangthaison91 avatar jvigneshcs avatar logicsb avatar sydney-o9 avatar xornorik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

svpinview's Issues

Pin Secure Delay

There is a delay of pin entries being secure when typing fast

Initialize the view programmatically!

I am having trouble initializing the SVPinView.
What should i pass as it's coder parameter ??
var view = SVPinView() // this is not allowed
var view = SVPinView(coder : NSCoder) // this also returns error

when input secret start with index of 2, it will wrong.

    // store text
    let text =  textField.text ?? ""
    let passwordIndex = index - 1
    if password.count > (passwordIndex) {
        // delete if space
        password[passwordIndex] = text == " " ? "" : text
    } else {
        **//it is wrong, it should input to  the index it should be.
        password.append(text)**
    }
    validateAndSendCallback()

didFinishCallback wrong call

  1. 4 digit pin view
  2. enter last 3 digit and check "didFinishCallback"
  3. And reenter last 3 digit and check "didFinishCallback"

Broken alignment on editing invisible text fields

On gif from readme text and cursor are aligned to horizontal center of each line.

Created test project with this control - on editing text alignment changes from "center" to "left" - independently on empty or non-empty text field.

Size of individual input

Is it possible to update the size of the input areas?

I can manage to get the width about accurate based on where I need to place this, but the height of each input area is too small.

Crash while opening SVPinCell

Unknown class SVPinField in Interface Builder file.

Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:],

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the cell returned from -collectionView:cellForItemAtIndexPath: does not have a reuseIdentifier - cells must be retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath:'

Autofill doesn't work at iPhone 6s - iOS 13.7

I have an issue with iPhone 6s - iOS 13.7. Autofill doesn't appear on the top of the official keyboard of the iOS.
It seems this behavior is occurred just on iPhone 6 - 6s
Here a buch of my code:

lazy var verificationTextField: SVPinView = { let textField = SVPinView() textField.translatesAutoresizingMaskIntoConstraints = false textField.pinLength = 6 textField.interSpace = 5 textField.borderLineColor = .red textField.activeBorderLineColor = .black textField.borderLineThickness = 1 textField.activeBorderLineThickness = 3 textField.becomeFirstResponderAtIndex = 0 textField.keyboardType = .numberPad textField.isContentTypeOneTimeCode = true textField.style = .underline return textField }()

Pin length inconsistency between view and password count

I had this issue in some projects where setting pin length to another length rather than the default value would update the view but the password count is still 5 leading to either crashes when the pin length is greater than the default value or not triggering didFinishCallback if less than 5.
I fixed this issue by moving the password array initialization to the collection view delegate method numberOfItemsInSection rather than in loadView that gets called in init method.

SVPin version : 1.0.6
Deployment Target : iOS 11
it doesn't appear in iOS 12.1 projects though.

Not working for 4 pin

I have set pin length to 4 and style to underline. Then the borderline color is not working (Whatever color you set, it's showing as clear color) but it is working for 6 pin.

Height of Pinview

Increasing height of view is not going to increase the height of pin view how can is solve this?

How do you change PIN styling without clearing it first?

I have a case where i need to change my PIN style text color, underline color when the PIN input is invalid. I can't seem to do this without calling pin.clearPin() which will reload the view and clear all the input. Is there another way to do this?
Thanks

Swift 4.2 (4.2.1) Update

Using Xcode 10.1 with Swift 4.2.1 (same on Xcode 10 w/ Swift 4.2)

Getting a compile error, which is an easy fix. Basically in ‘SVPinView.swift’ - on line 87, change these 2 uses of ‘UIViewAutoresizing’ to ‘UIView.AutoresizingMask’

... in case anyone needed this and for an update. Thank you for your repo!

Using backspace does not erase the mask

Steps to reproduce:

  1. Type in 3 out of 4 (for example) needed characters
  2. Press the backspace button
  3. Cursor goes back to the third character, but the "mask" character is still there.
    image

2 advices of SVPinView

1.hope to provide milliseconds property to set secure text after a bit, some time we don't need delay show secure text
2.when press delete key of keyboard wanna delete previous char or not just move the cursor to the text field
thanks

Show Pin

Hi!
Is there any chance to do "Show Pin" functionality?

English and Arabic Localization

I'm using English and Arabic Localization for my app and I have used this Pinview within my app. This is automatically changing the alignment from Left to Right. I do not want the change in the alignment.

I want to have the same as it is, like first textfield will start from left and last textfield on the right. I want this similar functionality in both English and Arabic.

Interspace property is not working properly

First of all thank you for the library. I am using your library in one of my project and setting "interSpace" is not working properly. If I set a space using this property then interspacing between views goes to 0. Could you please look into it?

becomeFirstResponder() doesn't work

I have put the field and wish it to be the FirstReponder on a view. But nothing I do can make the field become focussed as the first responder and bring up the keyboard? I have to click on the field to bring up the keyboard.

Carthage Support

first of all thanks for this project. Are you plan to support Carthage?

Feature Request - Loading Indicator

it might be too much for this view. but it would be nice if the textfields themselves start animating until the network request finishes.

Not always override character if focus a pinView

Hi;
Thanks for your work.
I wrap your view in a SwiftUI app.

In this app I see an odd behavior. If the user tap a single pinView in the left half of the view it can prevent the overwrite of the existing character.

I attach two screenshot to explain better myself. In the first (indicator is on the left) if the user digit a new character then the old one is not overwrite, in the second it will be overwrite.
wrong
Notice the indicator on the left side of the char.

right
notice the indicator on the right side of the char. In this case work

Problems with alignment

Created a view which intherits SVPinView and fulfills almost the whole screen.
Result: numbers are aligned to vertical center, lines aligned to bottom. They should be aligned to the same anchor point.

interSpace not working

I have init the pinview ..
pinView.frame = CGRect(x: 15, y: 150, width: frame.size.width - 30, height: 44)
and set it's interSpace to 20
pinView.interSpace = 20
it turns out it didn't center, and the space is not 20 at all
image

Backspace at char index 0 results in defocus

Hitting backspace while the cursor is in char index 0 position exits the field. I think that is a bug. Most PIN entry will not exit, but actually remain in position index 0 if the backspace key is used there.

clearPin() crash on iOS 10.3.3

In iOS version 10.3.3 of iPad, it crashes . It is bcoz cell.viewWithTag unable to typecast view into SVPinFeild.
Can i get any help on this??
Attached the crash below.
screen shot 2018-06-20 at 1 36 37 pm

OTP Autofill

Hi,
SPView doesn't work with textContentType = .oneTimeCode (ex: add textContentType to the first SVPinField).
Any idea how to solve the issue?

ERR-104: Tag Mismatch - Line 291

----------SVPinView Error----------
ERR-104: Tag Mismatch - Line 291

2020-04-17 09:01:25.854738+0800 nookprint[88745:19458510] *** Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3899.22.15/UICollectionView.m:2248
2020-04-17 09:01:25.858613+0800 nookprint[88745:19458510] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the cell returned from -collectionView:cellForItemAtIndexPath: does not have a reuseIdentifier - cells must be retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath:'

Install Manually Crashes on starting

I have copy source folder into xcode project
and then in my XIB added View of subclass SVPinView

added required properties and crashes on starting

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'the cell returned from -collectionView:cellForItemAtIndexPath: does not have a reuseIdentifier - cells must be retrieved by calling -dequeueReusableCellWithReuseIdentifier:forIndexPath:'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23e3cf0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ba89b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e3cc88 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff258b8bd2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff484367de -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 1277
5 UIKitCore 0x00007fff484362db -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 31
6 UIKitCore 0x00007fff4843bb7b -[UICollectionView _updateVisibleCellsNow:] + 6402
7 UIKitCore 0x00007fff48440cca -[UICollectionView layoutSubviews] + 351
8 UIKitCore 0x00007fff49193678 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2478
9 QuartzCore 0x00007fff2b4c6398 -[CALayer layoutSublayers] + 255
10 QuartzCore 0x00007fff2b4cc523 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 523
11 QuartzCore 0x00007fff2b4d7bba _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 80
12 QuartzCore 0x00007fff2b420c04 _ZN2CA7Context18commit_transactionEPNS_11TransactionEd + 324
13 QuartzCore 0x00007fff2b4545ef _ZN2CA11Transaction6commitEv + 649
14 UIKitCore 0x00007fff48ca3747 __34-[UIApplication _firstCommitBlock]_block_invoke_2 + 81
15 CoreFoundation 0x00007fff23da0b5c CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 12
16 CoreFoundation 0x00007fff23da0253 __CFRunLoopDoBlocks + 195
17 CoreFoundation 0x00007fff23d9b043 __CFRunLoopRun + 995
18 CoreFoundation 0x00007fff23d9a944 CFRunLoopRunSpecific + 404
19 GraphicsServices 0x00007fff38ba6c1a GSEventRunModal + 139
20 UIKitCore 0x00007fff48c8b9ec UIApplicationMain + 1605
21 App 0x000000010b0027bb main + 75
22 libdyld.dylib 0x00007fff51a231fd start + 1
23 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException

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.