Latest 2.0.1
Homepage https://github.com/Gini-Apps/GABiometricAuthentication
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

Markdownify

GABiometricAuthentication

Give your collection view the infinite scrolling behavior.

SponsorVersionAuthorSwiftSwift


GABiometricAuthentication

Table of Contents

  1. Requirements
  2. Installation
  3. How to Use

Requirements:

  • iOS 9.0+
  • Xcode 9.4+
  • Swift 4.1+

Installation:

CocoaPods

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

$ gem install cocoapods

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

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

target '<Your Target Name>' do
  pod 'GABiometricAuthentication'
end

Then, run the following command:

$ pod install

How to Use:

Open Registertion Popup:

Option 1 Use Default Size:

import "GABiometricAuthentication", then create GAFullScreenConfiguration and call to the function openRegisterForBiometricAuthentication with type "fullScrrenUI" in the GABiometricAuthentication class

import GABiometricAuthentication

let uiconfiguration = GAFullScreenUIConfiguration(titleText: NSAttributedString(string: "title"), descriptionText: NSAttributedString(string: "description"), backgroundColor: .white, centerImage: UIImage(named: "touch-id"), allowButtonConfiguration: GAFullScreenButtonConfiguration(backgroundColor: .black, textColor: .white, text: "Allow"), dontAllowButtonConfiguration: GAFullScreenButtonConfiguration(backgroundColor: .black, textColor: .white, text: "Do not Allow"))

let configuration = GAFullScreenConfiguration(uiConfiguration: uiconfiguration, localizedReason: "enter for password") { (result) in

        }

GABiometricAuthentication.openRegisterForBiometricAuthentication(usingRegisterType: .fullScrrenUI(configuration), inViewController: self)

Option 2 Custom UI:

Create object/view that implement CustomPopupUI

import GABiometricAuthentication

class MyCustomPopupView: UIView,CustomPopupUI
{

 var continerView: UIView
 {
        return self
 }

    // MARK: - IBOutlet
    @IBOutlet weak var allowButton      : UIButton! // subview of continerView
    @IBOutlet weak var doNotAllowButton : UIButton! // subview of continerView
}

Then create GACustomPopupConfiguration and pass the CustomPopupUI object using "GACustomPopupUIConfiguration".


let customPopupUI = MyCustomPopupView(frame: CGRect.zero)
let uiconfiguration = GACustomPopupUIConfiguration(customPopupUI: customPopupUI, popupSize: CGSize(width: 309.0, height: 284.0))
let configuration = GACustomPopupConfiguration(uiConfiguration: uiconfiguration, localizedReason: "enter for password") { (result) in

}

To show the registration popup call to the function openRegisterForBiometricAuthentication with type customUI in the GABiometricAuthentication class

GABiometricAuthentication.openRegisterForBiometricAuthentication(usingRegisterType: .customUI(configuration), inViewController: self)

Toggle Enter Biometric Local Authentication:

call to evaluateBiometricLocalAuthentication in GABiometricAuthentication.
pass to the function the localizedReason for using the biometric authentication and
the results block

 GABiometricAuthentication.evaluateBiometricLocalAuthentication(localizedReason: "showPassword") { [weak self] (result) in

    guard let strongSelf = self else { return }

    switch result
    {
    case .success   : strongSelf.resultLabel.text = "success"
    default         : strongSelf.resultLabel.text = "failed"
    }
}

Unlock Biometric Local Authentication:

if the user try more then the available number of tries the system will lock the biometric local authentication,
to unlock it call to unlockBiometricLocalAuthentication in GABiometricAuthentication

 GABiometricAuthentication.unlockBiometricLocalAuthentication(byLocalizedReason: "Access your password") { [weak self] (result) in

    guard let strongSelf = self else { return }

    switch result
    {
    case true   : strongSelf.resultLabel.text = "success"
    case false  : strongSelf.resultLabel.text = ""
    }

}

Check if Biometric Local Authentication Available:

to check if user can use biometric local authentication

  let canUseBiometric = GABiometricAuthentication.canEvaluatePolicyDeviceOwnerAuthenticationWithBiometrics()

Latest podspec

{
    "name": "GABiometricAuthentication",
    "version": "2.0.1",
    "summary": "This is pod handle BiometricAuthentication",
    "description": "This is pod handle BiometricAuthentication in the LocalAuthentication framework",
    "homepage": "https://github.com/Gini-Apps/GABiometricAuthentication",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "idoMeirov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Gini-Apps/GABiometricAuthentication.git",
        "tag": "2.0.1"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "9.0"
    },
    "frameworks": "UIKit",
    "source_files": "GABiometricAuthentication/Classes/**/*",
    "resources": "GABiometricAuthentication/Assets/PopUp/**/*"
}

Pin It on Pinterest

Share This