Latest 1.0.1
Homepage https://github.com/reececomo/UnlockCodeViewController
License MIT
Platforms ios 11.0
Authors

A simple drop-in Unlock Code view controller.

Codacy Badge
CodeCov Badge
Build Status
Docs Badge
Version
License
Platform

UnlockCodeViewController

Usage

Basic Usage

// Create the view controller
let viewController = UnlockCodeViewController(unlockCode: myCode)

// Present the view controller
navigationController.setViewControllers([viewController], animated: false)

// Set the unlock action (this can also be set in the constructor)
viewController.whenUnlocked { _ in
    navigationController.setViewControllers([myLockedContentViewController], animated: true)
}

Additional Config

// (Optional) Additional config
viewController.pinCharacter = "*"           // default: "●"
viewController.blankCharacter = "_"         // default: "○"
viewController.playsSound = false           // default: `true`
viewController.autoDismissOnUnlock = false  // default: `false`
viewController.autoDismissOnFailure = true  // default: `false`
viewController.maxAttemptsAllowed = 5       // default: 3

Generating an UnlockCode

  • Ideally you would set the unlock code remotely, and load it into your app.
  • Then next best option would be to use a pre-generated code. Otherwise anyone can decompile your application and read your code in plaintext.
    
    // Using a pre-generated code (e.g. "123456")
    let myCode = UnlockCode(
    hash: "2DBD6C5C6085CB173C76E0856CF2EB85DB6A464264704528187E18A808A0D569",
    salt: "O%[email protected]_Qy)gAa9d",
    length: 6,
    isNumeric: true
    )

// Or generate one on the fly (Not Recommended)
let myGeneratedCode = UnlockCode(generateFor: "123456")


## Documentation

Complete [documentation is available online](https://reececomo.github.io/UnlockCodeViewController).

## Example Project

To run the example project, clone the repo, and run in Xcode 10 or greater.

## Installation

### CocoaPods

UnlockCodeViewController is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod 'UnlockCodeViewController'

Author

Reece Como, [email protected]

License

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

Latest podspec

{
    "name": "UnlockCodeViewController",
    "version": "1.0.1",
    "summary": "A simple drop-in Unlock Code view controller.",
    "description": "A simple drop-in Unlock Code view controller. Use this to add a simple gateway screen to prevent access to content.",
    "homepage": "https://github.com/reececomo/UnlockCodeViewController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Reece Como": "[email protected]"
    },
    "source": {
        "git": "https://github.com/reececomo/UnlockCodeViewController.git",
        "tag": "1.0.1"
    },
    "platforms": {
        "ios": "11.0"
    },
    "swift_version": "4.2",
    "source_files": "UnlockCodeViewController/Classes/**/*"
}

Pin It on Pinterest

Share This