Giter Site home page Giter Site logo

reusableauthentication's Introduction

ReusableAuthentication

ReusableAuthentication is a powerful, pure-Swift library for Reuse Your Login and Signup Page with UI and Validations. It provides you a chance to use a pure-Swift way to work with remote ReusableAuthentication in your next app.

Features

  • Reuse UITextfield.
  • Change Color Properties of Textfield: Font-Color, Background-Color, Text-Color.
  • Add Customizable Placeholder text, left-right Image with Padding.
  • Validations: Email, Password, Phonenumber, Character Length Also you can add your regex or validation esaily.
  • View extensions for UIString, UITextfield and UIAlertController to directly add validations and show alert.

ReusableAuthentication

The simplest use-case is Drag UIView to your UIViewContrller in Interface and click on identity inspector add Custom Class ReusableLogin

Screen-Shot-2020-02-12-at-3-29-36-PM

Yeah! Now just bulid and run your project you find 6 Textfields there. right ? Yeah! Next step...

Create IBOutlet for ReusableLogin UIView.

@IBOutlet weak var reusableView: ReusableLogin!

Now i want 3 textfields then use this:

reusableView.numberOfTextfields = 3

It gives you array UITextfields:

reusableView.textFields

If you want first textfields:

reusableView.textFields.first

Let's Add Placeholder text and color for our Textfield:

reusableView.textfieldsPlaceholderAndColors(placeholders: ["Hello Guys", "Reusable Authentication", "My Placeholder"], colors: [.red, .blue, .black])

Same color on all textfield placeholders:

reusableView.textfieldsPlaceholderWithColor(placeholders: ["Hello Guys", "Reusable Authentication", "My Placeholder"], color: .black)

Add Image in Textfield like adding key image in Password

reusableView.textFields[1].textfieldLeftImage = UIImage(named: "Your Image Name")
reusableView.textFields[1].leftPadding = 8
reusableView.textFields[1].rightPadding = 8

same check for

fontName, fontSize,fontColor,customTextAlignment,borderColor,letterSpacing,cornerRadius ,customPlaceholer,horizontalInset,verticalInset,borderWidth,baseLineOffset

reusableView.textFields[1].fontSize = 18

Validations

Let's check all textfields are empty or not

let isAllEmpty = reusableView.textfieldsIsEmpty()
print(isAllEmpty) // It gives you true or false...

Check Length for textfield

let charLength = reusableView.textFields.first?.text?.validateLength() // default length is mini = 8 and max = 18
//charlength return Bool 

add Your custom length for textfield

let _ = reusableView.textFields.first?.text?.validateLength(mini: 5, max: 13)

add Validation for all textfields and also you can add your custom text message.. if it not validate then it showing your message with alert.. if it validate then it gives success in your completion. :-)

reusableView.validations(vc: self, validations: [.email, .password, .phonenumber], validationMessage: ["Email is wrong", "Password is incorrect", "Please check your phonenumber once"]) { (str) in
            print(str) // success
        }

Seperate Validation for textfields

For Email:
reusableView.textFields.first?.text?.validateEmailId()
Password:
reusableView.textFields.first?.text?.validatePassword()
And Phonenumber        
reusableView.textFields.first?.text?.validatePhoneNumber()

please check more validations...on String extension.

add Your Alert and Actionsheet easily alongwith meassages:

self.openAlert(title: "Alert", message: "Please Validate All Textfields", alertStyle: .alert, actionTitles: ["Okay", "Cancel"], actionStyles: [.default, .cancel], actions: [{_ in }, {_ in }])

Contact

Follow and contact me on Twitter or Youtube. If you find an issue, just open a ticket. Pull requests are warmly welcome as well.

Requirements

  • iOS 12.0+
  • Swift 4.0+

License

ReusableAuthentication is released under the MIT license. See LICENSE for details.

reusableauthentication's People

Contributors

yogeshpatelios avatar

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.