Latest 1.0.1
Homepage https://github.com/inloop/PinIndicatorView
License MIT
Platforms ios 8.0
Authors

Pin view sample

A simple UI component that mimics the lock screen pin indicator

Usage

Import the framework

import PinIndicatorView

Add the PinIndicatorView view to your storyboard and create an outlet

@IBOutlet weak var pinIndicator: PinIndicatorView!

You can set the required number of digits and the colour. The defaults are 4 and blue. You can either set this programatically or in your storyboard

pinIndicator.digitCount = 8
pinIndicator.color = .green

Fill or unfill the indicator when digit or backspace buttons are pressed

pinIndicator.addDigit()
pinIndicator.deleteDigit()

You can check if the required number of digits was inputted

pinIndicator.isFilled

If your validation fails trigger the shake animation and clear the indicator

pinIndicator.shake()
pinIndicator.clear()

Instalation

The library is available on cocoapods

pod 'PinIndicatorView', '~> 1.0'

Customisation

You can customise the indicator by supplying a custom renderer. The renderer implements the IndicatorRenderer protocol and is assigned to the renderer property of the indicator.

class MyIndicatorRenderer: IndicatorRenderer {
   func renderFilled(in rect: CGRect, context: CGContext) {
      // TODO: Draw the filled shape
   }

   func renderEmpty(in rect: CGRect, context: CGContext) {
      // TODO: Draw the outline
   }
}

Latest podspec

{
    "name": "PinIndicatorView",
    "version": "1.0.1",
    "summary": "Pin indicator that mimics the lock screen",
    "description": "A customisable pin indicator based on the iOS lock screen",
    "homepage": "https://github.com/inloop/PinIndicatorView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tomas Hakel": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "swift_version": "4.1",
    "source": {
        "git": "https://github.com/inloop/PinIndicatorView.git",
        "tag": "1.0.1"
    },
    "source_files": "PinIndicatorView/**/*.{swift}",
    "exclude_files": "Demo"
}

Pin It on Pinterest

Share This