Skip to content

EasyPin is a pod written in SwiftUI which lets you create PIN code and keypad easily with customisation according to your own liking.

License

Notifications You must be signed in to change notification settings

fahadshafiq48/EasyPin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyPin

CI Status Version License Platform

EasyPin logo

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS version 13 or above
  • SwiftUI

Installation

EasyPin is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'EasyPin'

Usage

You can find Demo App from the git repository in Example directory.

Step by step tutorial:

You can create customizable Pin view and its keypad by following the mentioned steps: Make sure to add EasyPin in Podfile & install it

import EasyPin in your code file

import EasyPin

Pin View

initialize variables which will hold your actual pin and its limit pinLimit represents the total count of pin dots

@State var pinCode = ""
let pinLimit = 4

Now you can simply make Pin view using the following code

PinCodeWidget.shared.addPinCode(limit: pinLimit, text: pinCode, fillColor: Color.blue,
borderColor: Color.white, height: 40, width: 40, cornerRadius: 20)

KeyPad View

To make the keypad first make a object of PinCodeWidget

let keypad = PinCodeWidget(keyHeight: 56, keyBgColor: .clear,
keyTextColor: .white, keyFont: .system(size: 48))

now use the keypad object and draw the keypad. Here we are onUpdate method with pinCode which allow us to perform some action when user will press some key

keypad.drawKeypad(pinCode: $pinCode.onUpdate {
    pinCodeUpdated()
}, backSpaceImg: Image("clear"), limit: pinLimit)

In pinCodeUpdated() function you can write what you want. For example, moving to next screen

Author

Fahad Shafiq, [email protected]

License

EasyPin is available under the MIT license. See the LICENSE file for more info.

About

EasyPin is a pod written in SwiftUI which lets you create PIN code and keypad easily with customisation according to your own liking.

Resources

License

Stars

Watchers

Forks

Packages

No packages published