Developing 3D Touch and Touch ID Apps for iOS Devices in Smartface

The latest release of Smartface, version 4.5, comes with 3D Touch (Force Touch) and Touch ID support for iOS devices, paving new ways for user interaction.

Smartface is fully native and you can develop next generation iOS apps with native features like 3D Touch and Touch ID just by using JavaScript.


3D Touch in Smartface

Force Touch is being used in all new generation Apple devices such as the new MacBook and Apple Watch and a more sensitive version named 3D Touch is released with iPhone 6S and 6S Plus. iPhone 7 and iPhone 6C are also expected to come with 3D Touch features. It should be noted that iPad Pro doesn’t have 3D Touch, it only has Apple Pencil with pressure sensors.

3D Touch is more than a gimmick; it adds a whole new dimension to the user interaction as the name implies. It allows the detection of the level of pressure exerted by the touches on the screen and trigger different actions with regards to the applied force (hence the name Force Touch).

Due to the special hardware, force detection is highly precise and one study even indicates that 3D Touch can detect up to 400 different points of pressure. Therefore, a single touch means more than just a tap.

As the reference implementation of 3D Touch, some iOS apps use Peek and Pop. For instance, in the inbox in Mail app, if you tap on a message, the message is shown fully. If you gently touch on a message (exerting small amount of a pressure), you get a “Peek” at the message without leaving the inbox, so you are back to the inbox when you stop touching. However, if you touch harder while “peek”ing (exerting a higher pressure than before), you can “Pop” the message to show it full screen.

With Smartface, it is easy to use 3D Touch in a similar manner. Below is a brief information about how 3D Touch is used with JavaScript. Please refer to the 3D Touch with Force Touch in iOS guide for more information as well as sample codes for 3D Touch implementation.

For objects that have touch events onPressed, onTouch, onTouchEnded, onDragInside and onDragOutside, iOS runtime provides a force value. This value is a number. This force value can be obtained from any of those events as e.force.

Also there is another value which keeps the maximum possible force value that is called maximumPossibleForce. This maximum force value can be obtained from the above events by e.maximumPossibleForce.

With Smartface, the force is always with you. Will you choose the dark side or follow the path of the light side? It is up to you how you are going to use the “force” in your native iOS apps.


Touch ID in Smartface

Since its release, Touch ID was met with skepticism. On one hand, it was praised for its accuracy and ease of use; on the other hand, there were some cases that showed that Touch ID can be hacked or some people claimed that providing passcodes as an alternative to Touch ID disavows the fact that Touch ID is a more secure mechanism for authentication.

Still, Touch ID is one of the more successful implementations of fingerprint authentication and Apple bets highly on it. Besides its main use of unlocking the iOS devices, it is integrated to other features on iOS such as Apple Pay or App Store purchases.

And of course, it has an API that can be used by app developers and now Smartface developers can also use Touch ID in their native iOS apps. iPhone 5S and later devices and iPad Air 2 and later devices support Touch ID, so the majority of the devices in the market are Touch ID capable.

The most important fact about Touch ID is that it is a local security mechanism. The biometry data (the fingerprints) are stored locally inside the processor of the iOS device and never shared with apps or sent to the cloud. Therefore, it is especially a good choice for second factor authentication, but it can be used in any authentication scenario.

The use of Touch ID is straightforward. The authentication process and the biometry data are never exposed to the developers for security reasons and only the result of the fingerprint scanning process can be utilized within the apps.

With Smartface, it is even easier to use Touch ID in native iOS apps. Below is a brief information about how Touch ID is used with JavaScript. Please refer to the Touch ID for Fingerprint in iOS guide for more information as well as sample codes for Touch ID implementation.

For using Touch ID, device.scanFingerPrint method is called with customization options for the texts that appear in Touch ID dialog. After a successful fingerprint authentication, onSuccess event is triggered and the app can continue with the operations for an authenticated user. If there is an error, the onError event is triggered with an error code and error description such as “Application retry limit exceeded”, “Canceled by user”, “UI canceled by system” or “Biometry is not available”.

The developer can direct the user to alternative ways of authentication if an error occurs in Touch ID authentication.

Just a few lines of code are sufficient to enable Touch ID in your iOS apps. Non-authenticated users “can’t touch this”.


You can develop native iOS apps with 3D Touch and Touch ID just with JavaScript. No Objective-C or Swift knowledge is required.

You can visit the related guide pages for more information on 3D Touch and Touch ID implementations and you can visit the Smartface Developer Center for more native iOS and Android development resources. For updates, you can follow us on Twitter @smartface_io


Download Smartface now and start coding right away for 3D Touch and Touch ID