Giter Club home page Giter Club logo

otpcontroller's Introduction

OTPController

OTPController is basically made for integrating One time password view. There are two styles: Line and Box.

Box Style Line Style

Getting Started

Prerequisites

  1. Minimum deployment target: iOS 10
  2. Orientation: Portrait Only
  3. Supported Language: English

Dependency

Installation

Copy OTPController directory in your project

Box Style OTPController Implementation

let vc = VerifyOTPViewController.instance()!
let config = BoxStyleConfig()

• Present OTPController

vc.presentWith(config:config, to: self) { (otp) in
    print(otp)
    vc.dismiss(animated: true, completion: nil)
}

• Navigate to OTPController

vc.pushWith(config:config, to: self) { (otp) in
    print(otp)
    vc.dismiss(animated: true, completion: nil)
}

Line Style OTPController Implementation

let vc = VerifyOTPViewController.instance()!
let config = LineStyleConfig()

• Present OTPController

vc.presentWith(config:config, to: self) { (otp) in
    print(otp)
    vc.dismiss(animated: true, completion: nil)
}

• Navigate to OTPController

vc.pushWith(config:config, to: self) { (otp) in
    print(otp)
    vc.dismiss(animated: true, completion: nil)
}

Style Configuration

Config class has following properties where you can customize the look and feel of control.

var titleText = "Please enter OTP to verify your Mobile Number"
var descText = "9812345678"
var fontLblTitle: UIFont = .systemFont(ofSize: 14.0)
var fontLblDesc: UIFont = .boldSystemFont(ofSize: 18.0)
var fontBtnResendOTP: UIFont = .boldSystemFont(ofSize: 12.0)
var fontBtnConfirm: UIFont = .systemFont(ofSize: 14.0)
var fontLblProgress: UIFont = .boldSystemFont(ofSize: 12)
var textColorLblTitle: UIColor =  colorLiteral(red: 0.3333333333, green: 0.3333333333, blue: 0.3333333333, alpha: 1)
var textColorLblDesc: UIColor =  colorLiteral(red: 0.3333333333, green: 0.3333333333, blue: 0.3333333333, alpha: 1)
var textColorBtnResendOTP: UIColor =  colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
var textColorBtnConfirm: UIColor =  colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
var bgColorBtnConfirm: UIColor =  colorLiteral(red: 0.8078431373, green: 0.8196078431, blue: 0.8352941176, alpha: 1)
var textColorLblProgress: UIColor =  colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
var colorOuterProgress: UIColor =  colorLiteral(red: 0.8078431373, green: 0.8196078431, blue: 0.8352941176, alpha: 1)
var colorInnerProgress: UIColor =  colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
var fontVwOTP: UIFont = UIFont(name: "Noteworthy-light", size: 20.0) ?? UIFont.systemFont(ofSize: 20.0)
var textColorVwOTP: UIColor =  colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
var bgColorActiveText: UIColor =  colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
var bgColorEmptyText: UIColor =  colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
var bgColorFilledText: UIColor =  colorLiteral(red: 0.8078431373, green: 0.8196078431, blue: 0.8352941176, alpha: 1)
var bgColorTextField: UIColor =  colorLiteral(red: 0.8078431373, green: 0.8196078431, blue: 0.8352941176, alpha: 1)
var timerInterval: TimeInterval = 60
var pinLength: Int = 4  // Lenght should be between 4 to 10

License

Copyright 2020

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and

limitations under the License.

otpcontroller's People

Contributors

mehulmodihb avatar

Stargazers

Karthick RJ avatar MohsinAli avatar

Watchers

MohsinAli avatar  avatar

Forkers

mohsinalimat

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.