Code Monkey home page Code Monkey logo

digitinputview's Introduction

DigitInputView

CI Status Version License Platform

DigitInputView

Installation

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

pod "DigitInputView"

Alternatively, you can simply copy DigitInputView/Classes/DigitInputView.swift into your project.

Usage

You can customize the look and feel of the view according to the following code snippet.

digitInput = DigitInputView()
    
digitInput.numberOfDigits = 6
digitInput.bottomBorderColor = .purple
digitInput.nextDigitBottomBorderColor = .red
digitInput.textColor = .purple
digitInput.acceptableCharacters = "0123456789"
digitInput.keyboardType = .decimalPad
digitInput.font = UIFont.monospacedDigitSystemFont(ofSize: 10, weight: 1)
digitInput.animationType = .spring
digitInput.keyboardAppearance = .dark

Options

numberOfDigits

The number of digits (characters) to show

Type: Int

Default: 4

bottomBorderColor

The color of the line under digits

Type: UIColor

Default: UIColor.lightGray

nextDigitBottomBorderColor

The color of the line under the digit that the user is about to input

Type: UIColor

Default: UIColor.gray

textColor

The color of the text

Type: UIColor

Default: UIColor.black

acceptableCharacters

If set, only the characters in this string are accepted. Anything else will be ignored.

Type: String?

Default: nil

keyboardType

The type of the keyboard to show to the user.

Type: UIKeyboardType

Default: UIKeyboardType.default

Values:

public enum UIKeyboardType : Int {

    
    case `default` // Default type for the current input method.

    case asciiCapable // Displays a keyboard which can enter ASCII characters

    case numbersAndPunctuation // Numbers and assorted punctuation.

    case URL // A type optimized for URL entry (shows . / .com prominently).

    case numberPad // A number pad with locale-appropriate digits (0-9, ۰-۹, ०-९, etc.). Suitable for PIN entry.

    case phonePad // A phone pad (1-9, *, 0, #, with letters under the numbers).

    case namePhonePad // A type optimized for entering a person's name or phone number.

    case emailAddress // A type optimized for multiple email address entry (shows space @ . prominently).

    @available(iOS 4.1, *)
    case decimalPad // A number pad with a decimal point.

    @available(iOS 5.0, *)
    case twitter // A type optimized for twitter text entry (easy access to @ #)

    @available(iOS 7.0, *)
    case webSearch // A default keyboard type with URL-oriented addition (shows space . prominently).

    @available(iOS 10.0, *)
    case asciiCapableNumberPad // A number pad (0-9) that will always be ASCII digits.

    
    public static var alphabet: UIKeyboardType { get } // Deprecated
}

animationType

The type of animation to use when showing a new digit (on being entered by the user)

Type: DigitInputViewAnimationType

Default: .spring

Values:


public enum DigitInputViewAnimationType: Int {
    case none, dissolve, spring
}

font

The font to be used with labels.

Type: UIFont?

Default: nil (Default System Font)

keyboardAppearance

Option to choose the keyboard's appearance. Possible values are:

default: This value is mapped to light

dark: Choose a dark keyboard

light: Choose a light keyboard

alert: An appearance appropriate for alert dialogs

Example

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

Author

mnvoh, [email protected]

License

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

digitinputview's People

Contributors

boranyldrm avatar iamrmohamed avatar kiril avatar mnvoh avatar

Watchers

 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.