Latest 1.0
Homepage https://github.com/oxozle/OXPatternLock
License MIT
Platforms ios 9.0
Authors

[CocoaPods Compatible]()
[CocoaPods]()
[CocoaPods]()
[CocoaPods]()
[Language]()

An iOS pattern lock like Android authentication written in Swift.

OXPatternLock

Installation

OXPatternLock requires Swift 3.0 and Xcode 8

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate OXPatternLock into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    # for stable release
    pod 'OXPatternLock'

    # for latest release
    pod 'OXPatternLock', :git => 'https://github.com/oxozle/OXPatternLock.git', :branch => 'master'
end

Then, run the following command:

$ pod install

Manually

Add OXPatternLock.swift to your project in Xcode

Usage example

  1. Create an implementation of the OXPatternLockDelegate protocol.

  2. Add OXPatternLock to your Storyboard/xib file or create it manually.

  3. For security reasons all processing you have to do manually. Receive callback from delegate with patternLock instance and track array. For example: if grid size equals 3 there are 9 track poins. So result track array will be array of integers from 0 to 8 like indexes in dots array.
func didPatternInput(patterLock: OXPatternLock, track: [Int]) {
  //store, check and update pattern with track array
}

Code example


//1. Create a OXPatternLock
let locker = OXPatternLock()

//2. Add OXPatternLock to view controller
self.view.addSubview(locker)

//3. Asset delegate
locker.delegate = self

//3. Implement the OXPatternLockDelegate
extension ExampleViewController: OXPatternLockDelegate {
    func didPatternInput(patterLock: OXPatternLock, track: [Int]) {
      //store, check and update pattern with track array
      print(track)
    }
}

Interface Builder support

There is support for Interface Builder. All properties configurable from Interface Builder.

OXPatternLock OXPatternLock

Customization

The locker can be customized by setting any of the following public properties before displaying the OXPatternLock. The defaults are shown below.

Property Description
dot: UIImage Default dot image in grid
dotSelected: UIImage Selected icon
lockSize: Int Width and Height of grid. Default value is 3 (grid 3×3 size).
trackLineColor: UIColor Track line highlight color. Default value is White.
trackLineThickness: CGFloat Thickness of track line. Default value is 5.

Known Issues

If you find any bugs please create an issue on Github.

License

OXPatternLock is available under the MIT license.

Latest podspec

{
    "name": "OXPatternLock",
    "version": "1.0",
    "summary": "An iOS pattern lock like Android authentication written in Swift",
    "homepage": "https://github.com/oxozle/OXPatternLock",
    "license": "MIT",
    "authors": {
        "Dmitriy Azarov": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/oxozle/OXPatternLock.git",
        "tag": "1.0"
    },
    "source_files": "Source/**/*.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This