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

Overview

SmileToUnlock

Cocoapods Swift Package Manager compatible

Make your users smile before opening the app :)

Demo gif
Gif with the demonstration

Installation

Cocoapods

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.

Swift Package Manager

Add the following as a dependency to your `Package.swift:

.package(url: "https://github.com/rsrbk/SmileToUnlock.git", from: "1.0.3")

and then specify "SmileToUnlock" as a dependency of the Target in which you wish to use SmileToUnlock. Here's an example:

 let package = Package(
     name: "Example",
     dependencies: [
         .package(url: "https://github.com/rsrbk/SmileToUnlock.git", from: "1.0.3")
     ],
     targets: [
         .target(name: "Example", dependencies: ["SmileToUnlock"])
     ]
 )

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 and older (a real device, not even a stimulator!) have 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.

You might also like...
PlacenoteSDK Sample app in native iOS using ARKit, written primarily in Swift

Placenote SDK for iOS Placenote SDK lets you easily build cloud-based Augmented Reality (AR) apps that pin digital content to locations in the real wo

Power! Unlimited power for ARKit 2.0!
Power! Unlimited power for ARKit 2.0!

A long time ago in a galaxy, far, far away... It is a period when iPhone SE and iPhone X were destroyed from the apple store, the AR market was under

A simple application created for educational purposes for mastering ARKit
A simple application created for educational purposes for mastering ARKit

ARDrawing AR Drawing is a simple application created for educational purposes for mastering ARKit. The basis of the project is copied from the project

Trying TDD with ARKit
Trying TDD with ARKit

ARPlacer BDD Spec As a user I want to place a random object in real world. I also want to see the distance between AR object and my phone. Use Cases

Draw VR content over live camera feed with ARKit

funny-ar Exercise with ARKit: draw VR content over live camera feed: work is in

ARKit: Projecting 3D mesh to 2D coordinate
ARKit: Projecting 3D mesh to 2D coordinate

ARKitDemo ARKit: Projecting 3D mesh to 2D coordinate A simple utility to project 3D face mesh in 2D coordinate on device screen. Sources: https://deve

Furniture E-Commerce Augmented Reality(AR) app in iOS powered by ARKit
Furniture E-Commerce Augmented Reality(AR) app in iOS powered by ARKit

HomeMax-iOS Furniture E-Commerce Augmented Reality(AR) app in iOS powered by ARKit and SceneKit. Inspired by IKEA place app. Description Experience on

ARID - Augmented Reality app using Apple’s ARKit framework which can recognise faces of famous scientists
ARID - Augmented Reality app using Apple’s ARKit framework which can recognise faces of famous scientists

ARID Augmented Reality app using Apple’s ARKit framework which can recognise fac

ARDicee - Simple augmented reality app using SceneKit and ARKit
ARDicee - Simple augmented reality app using SceneKit and ARKit

ARDicee Simple augmented reality app using SceneKit and ARKit Requirements Xcode

Releases(1.0.3)
Owner
Ruslan Serebriakov
Ruslan Serebriakov
A library that allows you to generate and update environment maps in real-time using the camera feed and ARKit's tracking capabilities.

ARKitEnvironmentMapper Example To run the example project, clone the repo, and run pod install from the Example directory first. Installation ARKitEnv

SV Hawks 91 Dec 4, 2022
Augmented Reality image tracking with SwiftUI, RealityKit and ARKit 4.

ARImageTracking This is an Augmented Reality Xcode project that uses Apple's newest RealityKit framework and ARKit 4 features, to dynamically track a

Richard Qi 198 Dec 7, 2022
Sample iOS AR app that demonstrates how to capture the texture of a user's face in realtime.

Sample iOS AR app that demonstrates how to capture the texture of a user's face in realtime. This texture can be used to create a simple textured 3D face model.

Matt Bierner 58 Dec 14, 2022
Caffeine tracking for everyone

Cortado Cortado is an iPhone app to help you track your caffeine consumption habits. Besides letting you manually enter caffeine data, it detects when

Emilia 169 Oct 16, 2022
This is a minimal AR Portal app that uses the RealityKit's occlusion materials to hide the inner space

AR Simple Portal This is a minimal AR Portal app that uses the RealityKit's occlusion materials to hide the inner space. Xcode 13.2.1 Target: iOS / iP

Yasuhito Nagatomo 6 Aug 10, 2022
ARKit + CoreLocation: Combines the high accuracy of AR with the scale of GPS data.

ARKit: Uses camera and motion data to map out the local world as you move around. CoreLocation: Uses wifi and GPS data to determine your global locati

Andrew Hart 5.3k Dec 27, 2022
ARKit Demo Application

ARKitNavigationDemo Work in progress. In Progress Region — For one, we could render far fewer nodes. In fact, it’s a bit distracting that the entire t

Christopher Webb 296 Dec 16, 2022
An iOS Framework Capture & record ARKit videos 📹, photos 🌄, Live Photos 🎇, and GIFs 🎆.

An iOS Framework that enables developers to capture videos ?? , photos ?? , Live Photos ?? , and GIFs ?? with ARKit content.

Ahmed Bekhit 1.5k Dec 24, 2022
IOS example app to generate point clouds in ARKit using scenedepth

Visualizing a Point Cloud Using Scene Depth Place points in the real-world using the scene's depth data to visualize the shape of the physical environ

Isak Diaz 20 Oct 31, 2022
ARKit Base Project. Place virtual objects based on WWDC example project

ARKit - Placing Virtual Objects in Augmented Reality Learn best practices for visual feedback, gesture interactions, and realistic rendering in AR exp

Ignacio Chiazzo Cardarello 338 Jan 5, 2023