/BlockInputView

Primary LanguageSwiftMIT LicenseMIT

BlockInputView

Version Platform

Installation

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

pod 'BlockInputView'

Usage

BlockInputView is very simple to use, to setup BlockInputView follow below step,

  • Assign class BlockInputView to that UIView on with you want to make blockInput.
  • Make it's outlet in ViewController
  • Call following method
  public func activate(widgetAppearance: WidgetAppearance = WidgetAppearance()) 

Properties

  public func activate(widgetAppearance: WidgetAppearance = WidgetAppearance()) 

Function above takes WidgetAppearance Object as parameter in which you can configure following properties.

Functional Properties

  • isMandatory: Bool
  • minNumberOfSections: Int
  • sectionWidth: Int
  • minLength: Int
  • maxLength: Int
  • isSecureTextEntry: Bool

Input Fields

  • textColor: UIColor
  • FontSize: CGFloat
  • FontName: String
  • hintColor: String
  • hintText: String

Error Message

  • errorFontName: String
  • errorFontSize: String
  • errorTextColor: UIColor
  • errorMessage: String
  • emptyMessage: String

Bottom Lines

  • bottomLineFocusOutColor: UIColor
  • bottomLineFocusedColor: UIColor
  • bottomLineErrorColor: UIColor

Other Properties

  • blockSpacing: CGFloat
  • cursorColor: CGFloat
  • keyboardType: UIKeyboardType

Methods

  • Following method will return text written in inputview.
  public func getFieldText() -> String 
  • Following method will validate contraints (e.g maxLenght, isMandatory, minLength) and return true or false on result of validation.
  public func validate() -> Bool 
  • Activate will initialize BlockInputView
  public func activate(widgetAppearance: WidgetAppearance = WidgetAppearance()) 

Demo

BlockInputView provides natural way to input card number, pin, one-time password. Following are some examples.

  • Card Number
  • Secure PIN
  • Invalid Input

Author

herralimurad, herralimurad@gmail.com

License

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