Iphone6s and Iphone6s Plus is equipped with iOS9, a new feature called 3D Touch, this feature is very useful, the key is to use, which gives a new way to interact with the choice and thinking, such as the game's additional control options, drawing applications in the fine-grained ( fine-grained) control, or even an excellent choice to replace the long-press operation (Tap-and-hold) we have used on IOS devices.
Developers can use 3D Touch through a very simple API, essentially a simple new property of Uitouch.
Override func Touchesbegan (Touches:set<Uitouch>, withevent event:uievent?) { guard Let Touch = Touches.first else {return} if traitcollection.forcetouchcapability = =. Available { println ("Touch pressure is \ (Touch.force), maximum possible-is \ (Touch.maximumpossibleforce)") }}
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.
In summary, the introduction of 3D Touch provides an entirely new way for iOS devices to interact, and will bring new generations of innovation to the next iOS app. Example code and related information about 3D Touch can be found on the Apple developer site https://developer.apple.com/ios/3d-touch/Reference.
Notes on 3D Touch development Tips