GithubHelp home page GithubHelp logo

redhatmk / smiletounlock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rsrbk/smiletounlock

0.0 0.0 0.0 16.98 MB

This library uses ARKit Face Tracking in order to catch a user's smile.

License: MIT License

Ruby 4.11% Swift 95.89%

smiletounlock's Introduction

SmileToUnlock Pod status

Make your users smile before opening the app :)

Demo gif
Gif with the demonstration

Installation

The most preferable way to use this library is cocoapods. Add the following line to your Podfile:

pod 'SmileToUnlock'

and run pod install in your terminal.

Alternatively, you can manually add the files in the SmileToUnlock directory to your project.

Usage

First of all, you have to add NSCameraUsageDescription to you Info.plist with a brief explanation.

Then you need to check if a user's device has the face tracking support:

if SmileToUnlock.isSupported {
}

Keep in mind that only iPhone X (a real device, not even a stimulator!) has this support currently.

Then just create an instance of the SmileToUnlock and specify the success handler:

if SmileToUnlock.isSupported {
    let vc = SmileToUnlock()
    vc.onSuccess = {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let vc = storyboard.instantiateInitialViewController()!
        self.window?.rootViewController = vc
    }
    window?.rootViewController = vc
}

If you want SmileToUnlock to be presented on your app's launch, add the code above to your didFinishLaunchingWithOptions method in AppDelegate.

Few additional customization properties:

public var titleText: String? = "Hello,"
public var subtitleText: String? = "Begin using our app from the smile"
public var skipButtonText: String? = "Skip this"

/// Sound to play after a user has smiled. Set to nil if you don't want a sound to be played.
public var successSoundPlaying: (() -> Void)? = {
    AudioServicesPlaySystemSound(1075)
}

/// Set how much smile do you need from a user. 0.8 is kind of hard already!
public var successTreshold: CGFloat = 0.7

/// Background color for this view controller.
public var backgroundColor: SmileToUnlockBackground = .blue

There are 3 preinstalled background colors. You can set your custom one as well:

public enum SmileToUnlockBackground {
    case blue
    case red
    case purple
    case other(UIColor)
}

Blue Red Purple

Feature requests

If you wish to contribute, look at this topics:

  • Improving the face itself (maybe some 3D model)
  • Adding additional emotions (like eye blinking)
  • Improving the UI of the screen

Follow me on twitter

I promise it's gonna be more interesting stuff there! @rsrbk123

Check out my other libraries

SRCountdownTimer - a simple circle countdown with a configurable timer.
SRAttractionsMap - the map with attractions on which you can click and see the full description.

License

MIT License

Copyright (c) 2017 Ruslan Serebriakov [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

smiletounlock's People

Contributors

rsrbk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.