A library for make a beautiful Passcode Lock View

Last update: Jun 29, 2022

SmileLock

GitHub Issues Version License Platform

A library for make a beautiful Passcode Lock View, also support Touch ID.

Requirements

  • iOS 9.0+
  • Swift 4 (pod version 3.x), Swift 3 (pod version 2.x), Swift 2.3 (pod version 1.x)

What can it do for you?

1. Create a beautiful passcode lock view simply.

let kPasswordDigit = 6
passwordContainerView = PasswordContainerView.create(withDigit: kPasswordDigit)

2. Passcode input completed delegate callback.

let passwordContainerView: PasswordContainerView = ...
passwordContainerView.delegate = self

extension ViewController: PasswordInputCompleteProtocol {
    func passwordInputComplete(passwordContainerView: PasswordContainerView, input: String) {
        print("input completed -> \(input)")
        //handle validation wrong || success
    }
}

3. Touch ID and Face ID

Thanks for the contribution of Piotr Sochalewski. 👍

extension ViewController: PasswordInputCompleteProtocol {
     func touchAuthenticationComplete(passwordContainerView: PasswordContainerView, success: Bool) {
        if success {
            //authentication success
        } else {
            passwordContainerView.clearInput()
        }
    }
}

Face ID requirements

Using Face ID requires adding NSFaceIDUsageDescription to your Info.plist otherwise the app would crash trying to use it.

4. Customize UI.

passwordContainerView.tintColor = UIColor.color(.textColor)
passwordContainerView.highlightedColor = UIColor.color(.blue)

5. Visual Effect.

If you want to see no visual effect, change the property isBlurUI to false in HomeViewController.swift.

How to use it for your project?

SmileLock is available through use CocoaPods.

To install it, simply add the following line to your Podfile:

pod 'SmileLock'

Or you can drag the SmileLock folder to your project.

Another Approach

You can subclass PasswordUIValidation for a more simple & elegant code. More detail please refer BlurPasswordLoginViewController.swift.

override func viewDidLoad() {
        super.viewDidLoad()

        //create PasswordUIValidation subclass
        passwordUIValidation = MyPasswordUIValidation(in: passwordStackView)

        passwordUIValidation.success = { [weak self] _ in
            print("*️⃣ success!")
            self?.alertForRightPassword { _ in
                self?.passwordUIValidation.resetUI()
            }
        }

        passwordUIValidation.failure = { _ in
            //do not forget add [weak self] if the view controller become nil at some point during its lifetime
            print("*️⃣ failure!")
        }

        ...
    }

Contributions

  • Warmly welcome to submit a pull request.

Credits

SmileLock is owned and maintained by RECRUIT LIFESTYLE CO., LTD..

License

Copyright (c) 2016 RECRUIT LIFESTYLE CO., LTD.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

GitHub

https://github.com/recruit-lifestyle/Smile-Lock
Comments
  • 1. Issue with TouchID button allowing access after initial touch auth

    This happens in the demo app.

    After a successful TouchID authentication, subsequent presses of the TouchID button in the pin pad result in auth success without any auth happening

    Steps to reproduce:

    Start SmileLock demo app on a device w/ TouchID Tap the TouchId button Authenticate - auth works as expected Background the app then bring it back to the foreground Tap the TouchID button Results: "Right Password" alert without actually having to authenticate

    Reviewed by mark-oliveira at 2016-07-28 19:15
  • 2. strange behaviour

    Hello, I've been using your smile lock library, I've found some problems: 1- The touchid icon on the lower left appears and dissapears without me doing anything(I mean, when I call the password controller, sometimes is there, and others it isn't, without me changing anything in the code) If the touchid icon doesn't appear, I can click in the left space, but it won't work, so I think that it really gone.

    2- Other problem is when I unlock with the touchid (when it allows me to) it opens again, it only closes definitely when I use the pin number.

    3- My last problem it's its performance is being erratic, I mean, I can enter the pin, but the animation on the clicked buttons don't show, or shows later and longer than it should. Sometimes it work's amazingly, but others it get really slow. Anyway, I think this could be caused by my code, but I tell you for the record.

    The two first problems are destroying my head, don't know what it could be.

    Thanks :)

    Reviewed by arknee at 2017-06-06 18:16
  • 3. 3.0.1 does not compile on Swift 4

    Since the update to 3..0.1, SmileLock refuses to compile on xCode 9 with swift 4. The error is the following:

    Value of type 'LABiometryType' has no member 'typeFaceID'

    This error can be found in the PasswordContainerView.swift on line 148, in the awakeFromNib() function.

    Reviewed by rvoortman at 2018-01-24 08:09
  • 4. Remove Touch ID Icon From Lock View

    Hi,

    How can I hide the Touch ID icon & feature from the default Blur Passcode Lock View?

    Is there any function that I can call?

    Thanks for the help in advance.

    Reviewed by IndraAdam at 2017-07-05 07:39
  • 5. Updated Swift 4.2 obsolete class names

    Updated UIControlState() to UIControl.State() and UIViewAnimationOptions() to UIView.AnimationOptions()

    For now, it only works in XCode beta3 due to the zero property on UIEdgeInsets error.

    https://download.developer.apple.com/Developer_Tools/Xcode_10_beta_3/Release_Notes_for_Xcode_10_beta_3.pdf

    There is also a workaround as per SO answer:

    https://stackoverflow.com/questions/50704200/fatal-error-encountered-while-deserializing-sil-global-uiedgeinsetszero

    Reviewed by GritfulOne at 2018-07-11 07:32
  • 6. how can i disable and hide touch id and face id

    @liu044100 I use below code to configure password view but in the scene, I have face id button and I don't what that. I want to hide this button

    ` passwordUIValidation = MyPasswordUIValidation(in: passwordStackView)

        passwordUIValidation.success = { [weak self] _ in
            print("*️⃣ success!")
            self?.dismiss(animated: true, completion: nil)
    self?.appDelegate.gotoRepeatView = true
            self?.present("BlurPasswordLoginViewRepeatController")
    
    
        }
    
        passwordUIValidation.failure = {
            //do not forget add [weak self] if the view controller become nil at some point during its lifetime
            print("*️⃣ failure!")
        }
    
        //visual effect password UI
        passwordUIValidation.view.rearrangeForVisualEffectView(in: self)`
    
    Reviewed by rexi1rios at 2018-05-22 12:35
  • 7. Transparent background color for password input view

    Hi,

    I love this UI component. I am using it in a app i am developing and i have a question regarding customising the look and feel.

    Basically i want the password input views to have a solid border color (white) with a transparent background color.

    I tried setting sit up with the following settings:

    //customize password UI passwordContainerView?.tintColor = UIColor(hexString: "#959595") passwordContainerView?.highlightedColor = UIColor(hexString:"#50C5D7")

    passwordContainerView?.passwordInputViews.forEach({ (view:PasswordInputView) in view.circleBackgroundColor = UIColor.ClearColor() view.borderColor = UIColor(hexString: "#959595") ?? UIColor.whiteColor() view.highlightBackgroundColor = UIColor(hexString:"#50C5D7") ?? UIColor.blackColor() view.textColor = UIColor.whiteColor() view.highlightTextColor = UIColor.whiteColor() })

    But the password input field do not have a clear background color but instead have the border color is this correct? There is no way to set them up separately from each other?

    Reviewed by Conrad-m-wise at 2016-08-05 12:53
  • 8. Authentication with Touch ID

    I added possibility to unlock with Touch ID. It works well and shows button to use Touch ID in the left bottom corner.

    It's disabled in default setup, but can be enabled when touchAuthenticationEnabled is true. When device doesn't support Touch ID or user doesn't set it in Settings, then no matter what touchAuthenticationEnabled button is still invisible. The reason visible for user can be set through touchAuthenticationReason property. Also Touch ID authentication can be checked thanks to isTouchAuthenticationAvailable.

    I added to PasswordInputCompleteProtocol new function touchAuthenticationComplete(passwordContainerView: PasswordContainerView, success: Bool). Unfortunately it cannot be optional (I considered the protocol as @objc, but then it cannot be implemented by generic PasswordUIValidation<T>).

    img_1291

    Reviewed by sochalewski at 2016-07-20 07:11
  • 9. FaceID crashing on iOS 12

    I've noticed FaceID crashing on iOS 12. This seems to happen on all phones with FaceID (including the iPhone X, XR en S Max).

    Steps to Reproduce:

    1. Enable FaceID
    2. Open the smile lock password screen
    3. Click the FaceID button
    4. Crash

    The stacktrace doesn't say much to me, but perhaps this will say something to someone:

    libsystem_kernel.dylib`__abort_with_payload:
        0x112d3a014 <+0>:  movl   $0x2000209, %eax          ; imm = 0x2000209 
        0x112d3a019 <+5>:  movq   %rcx, %r10
        0x112d3a01c <+8>:  syscall 
    ->  0x112d3a01e <+10>: jae    0x112d3a028               ; <+20>
        0x112d3a020 <+12>: movq   %rax, %rdi
        0x112d3a023 <+15>: jmp    0x112d1ce67               ; cerror_nocancel
        0x112d3a028 <+20>: retq   
        0x112d3a029 <+21>: nop    
        0x112d3a02a <+22>: nop    
        0x112d3a02b <+23>: nop    
    

    Possible related to https://www.howtoisolve.com/face-id-not-working-on-iphone-x/.

    Reviewed by rvoortman at 2018-10-04 07:42
  • 10. Touch ID Missing

    Hi,

    don't you think this is missing in PasswordContainerView.swift ??

    if touchIDContext.biometryType == .touchID { let bundle = Bundle(for: type(of: self)) image = UIImage(named: "Touch", in: bundle, compatibleWith: nil)?.withRenderingMode(.alwaysTemplate) } in simulator the Image is not displayed ??

    Reviewed by i-arun-samui at 2018-07-09 02:59
  • 11. Add modifiable font and fontSize

    Hello,

    First thank you for this amazing work. For the moment it's impossible to change the font of each passwordInputViews. Could you made if modifiable ?

    Thank you very much,

    LO.

    Reviewed by lucojsmerson at 2018-05-25 15:04
  • 12. Reject application for implementing smile lock

    Application rejecting for the new security added Apple store at February updated. UI design same as the Apple, that is the issue they told me.

    Reason for apple store: "Your app contains features that mimic the PIN code entry screen that resembles the native iOS PIN code screen." Screen Shot 2021-02-02 at 10 21 26 AM

    Reviewed by Risbinp at 2021-02-02 07:44
  • 13. The last PIN dot never appears to be completed

    The method "passwordInputComplete" of PasswordInputCompleteProtocol is called before the last dot appears. The last dot is left blank. Could you please fix this?

    Reviewed by krakhotcko at 2019-11-26 09:08
  • 14. SmileLock Integration

    I am new in Xcode.. I added pod 'SmileLock' into my pod file successfully. Now How can I implement UI in my Viewcontroller. Please explain in details.

    Reviewed by Appdevsoft at 2019-06-08 06:05
Related tags
iOS 7 style Passcode Lock
iOS 7 style Passcode Lock

LTHPasscodeViewController Simple to use iOS 7 style Passcode - the one you get in Settings when changing your passcode. How to use Drag the contents o

Aug 3, 2022
An iOS passcode lock with TouchID authentication written in Swift.
An iOS passcode lock with TouchID authentication written in Swift.

PasscodeLock A Swift implementation of passcode lock for iOS with TouchID authentication. Originally created by @yankodimitrov, hope you're doing well

May 9, 2022
A modal passcode input and validation view controller for iOS
A modal passcode input and validation view controller for iOS

TOPasscodeViewController A modal passcode input and validation view controller for iOS. TOPasscodeViewController is an open-source UIViewController su

Jul 1, 2022
iOS 14 checkra1n-jailbreak-targeted passcode interposition

lockdown I can't remember if this version (involving ksecured) is actually functioning, Started working on this right before I moved, haven't really w

Jul 10, 2022
A wrapper to make it really easy to deal with iOS, macOS, watchOS and Linux Keychain and store your user's credentials securely.

A wrapper (written only in Swift) to make it really easy to deal with iOS, macOS, watchOS and Linux Keychain and store your user's credentials securely.

Mar 29, 2022
FruitsDic-ios-practice - To Practice onboarding , List, detail and setting View
FruitsDic-ios-practice - To Practice onboarding , List, detail and setting View

?? FruitsDic-ios-practice ?? 기능 상세 OnBoding Screen with Page Tab View Data model

Jan 12, 2022
Swift cross-platform crypto library using CommonCrypto/libcrypto

BlueCryptor Swift cross-platform crypto library derived from IDZSwiftCommonCrypto. IMPORTANT NOTE: This release is NOT entirely source code compatible

May 18, 2022
A wrapper for Apple's Common Crypto library written in Swift.

IDZSwiftCommonCrypto A Swift wrapper for Apple's CommonCrypto library. IDZSwiftCommonCrypto works with both CocoaPods and Cathage. For more details on

Aug 4, 2022
Swift cross-platform crypto library using CommonCrypto/libcrypto

BlueCryptor Swift cross-platform crypto library derived from IDZSwiftCommonCrypto. IMPORTANT NOTE: This release is NOT entirely source code compatible

May 18, 2022
A powerful, protocol-oriented library for working with the keychain in Swift.

Locksmith A powerful, protocol-oriented library for working with the keychain in Swift. ?? iOS 8.0+ ?? Mac OS X 10.10+ ⌚️ watchOS 2 ?? tvOS ?? I make

Jul 22, 2022
KeyClip is yet another Keychain library written in Swift.

KeyClip KeyClip is yet another Keychain library written in Swift. Features Multi Types ( String / NSDictionary / NSData ) Error Handling Settings ( kS

Feb 2, 2022
LocalAuth - Another Fusion library to implement the local authentication using Biometry

FusionLocalAuth Another Fusion library to implement the local authentication usi

Jan 13, 2022
SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.
SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords.

SVPinView SVPinView is a light-weight customisable library used for accepting pin numbers or one-time passwords. Getting Started An example project is

Jul 18, 2022
iOS library for device fingerprinting. Does not require server APIs to work, fully client-side operation.
iOS library for device fingerprinting. Does not require server APIs to work, fully client-side operation.

Lightweight iOS library for local device fingerprinting Installation (CocoaPods) # Podfile pod 'FingerprintJS' Note: If you've never used CocoaPods fo

Jul 26, 2022
An iOS passcode lock with TouchID authentication written in Swift.
An iOS passcode lock with TouchID authentication written in Swift.

PasscodeLock A Swift implementation of passcode lock for iOS with TouchID authentication. Installation PasscodeLock requires Swift 2.0 and Xcode 7 Car

Jul 27, 2022
iOS 7 style Passcode Lock
iOS 7 style Passcode Lock

LTHPasscodeViewController Simple to use iOS 7 style Passcode - the one you get in Settings when changing your passcode. How to use Drag the contents o

Aug 3, 2022
An iOS passcode lock with TouchID authentication written in Swift.
An iOS passcode lock with TouchID authentication written in Swift.

PasscodeLock A Swift implementation of passcode lock for iOS with TouchID authentication. Originally created by @yankodimitrov, hope you're doing well

May 9, 2022
This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "make it black" and change the background color of the view in the frame.
This app is a sample app that recognizes specific voice commands such as

VoiceOperationSample This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "mak

Dec 3, 2021
A modal passcode input and validation view controller for iOS
A modal passcode input and validation view controller for iOS

TOPasscodeViewController A modal passcode input and validation view controller for iOS. TOPasscodeViewController is an open-source UIViewController su

Jul 1, 2022
A passcode entry field for macOS similar to Apple's two-factor authentication field.
A passcode entry field for macOS similar to Apple's two-factor authentication field.

DSFPasscodeView A passcode entry field for macOS similar to Apple's two-factor authentication field. About The control is made up of multiple groups o

Jan 6, 2022