With the launch of the iphone 6s and iphone 6s Plus, developers can now have a 3D Touch feature for their app, which opens up a new dimension for interacting with the interface.
As Apple says, developers can use 3D Touch through a very simple API, essentially a simple new property of Uitouch.
Override event: Uievent? ) { elsereturn } if traitcollection.forcetouchcapability = = . Available { println ("Touch pressure is \ (Touch.force), maximum possible Touch.maximumpossibleforce) }}
This new API allows applications to play a huge role, such as additional control options in the game, fine-grained (fine-grained) control in drawing applications, and even a great choice to replace the long-press operation (Tap-and-hold) we used on IOS devices.
In addition to the new APIs in Uitouch, Apple has provided two sets of classes to add 3D Touch functionality to the app: Uipreviewaction and Uiapplicationshortcutitem.
Uipreviewaction allows developers to quickly display something in a new preview window when the user touches a UI element using the 3D Touch feature. This fast-browsing approach to application-specific content is really great, for example, when we can quickly preview email messages, photos, and even web content without having to pop up a full view controller.
The Uiapplicationshortcutitem object enables an amazing new feature to be activated on the IOS home screen. When a user presses an app's icon with 3D Touch, a list of options pops up, allowing the user to quickly jump to a specific part of the app or perform a function within an app.
All in all, the introduction of 3D Touch unlocks a whole new way of interacting with iOS devices, and will bring new generations of innovation to the next iOS app.
Configure 3D Touch functionality for your app