Related Blogs
Gestures to perform actions like to wake up device or to open camera or to ON the flashlight amazed touch screen device users. Though gestures eased the actions, but they were limited to particular in-built applications only. What if, you can read the message without opening the app or can view the animated lock screen wallpaper? Apple with 3D Touch surprised users with system-level gestures where actions can be performed sensing hard or soft taps.
Beyond tap or pinch gestures, 3D Touch caters something fascinating, where users can press app icon and access immediate actions provided, can view recent or frequents in widget or press notifications and perform quick functionalities of it or press brief views to get detail preview. 3D Touch, an extension dimension of Multi touch accelerated access to ios applications.
Even though, 3D Touch is implemented in individual iPhone app development, it is not just the software based. Flabbergast? Have a brief look how 3D Touch is also hardware-based execution and not just software-based.
Tech appended for 3D Touch
With other hardware improvements like Apple A9 chip with embedded M9 motion coprocessor, 12MP rear-facing iSight camera, second-generation Touch ID in iPhones 6S and iPhone 6S plus, Apple also showcased major transfiguration in screen – making phone compatible to 3D Touch technology.
The transfiguration is adding up 4-layered sensitive display which responds based on the type of touch – Light, Medium and Firm. Four layers, based on their response system-level application developed reverts, incorporates –
- Retina HD Display with 3D Touch: It helps in detecting the finger pressure applied by the user.Retina HD display on backlight is attached with the capacitive pressure sensors.
- Capacitive Pressure Sensors:When cover glass is pressed,sensors measures the pressure from the space between cover glass and backlight,accordingly it will respond back.
- Taptic Engine:For elegant haptic feedback engine,Taptic Engine is used.It is capable enough to precisely respond to each measure of pressures on the screen.
Subject to such changes in hardware, 3D Touch technology is executed in iOS App Development. Apps are upgraded accordingly to make it compatible to 3D Touch.
Implementing 3D Touch in iPhone App Development
iOS 9 or later supports 3D Touch. To start implementing 3D Touch, it is necessary to download Xcode projects namely – ApplicationShortcuts, ViewControllerPreviews and TouchCanvas. 3D Touch comes with three categories – Home screen Quick Actions, Peek and Pop and Pressure and Intensity Sensitivity
Home Screen Quick Actions
Tap an app icon on Home screen and access static or dynamic quick actions. UIApplicationShortcutItems array is used to define static or dynamic quick action in iPhone application development Info.plist file.
Dynamic quick actions come up with additional shortcuts in app’s shared UIApplication, so add it in shortcutItems property. Define dynamic quick actions using UIApplicationShortcutItem, UIMutableApplicationShortcutItem, and UIApplicationShortcutIcon classes.
Peek and Pop
To support view and preview, iOS 9 SDK includes support in UIViewController class. registerForPreviewing(with:sourceView) method registers the view controller to participate in 3D Touch preview (peek) and commit (pop) behaviors. UIViewControllerPreviewing Protocol Reference justifies interface for 3D Touch-enabled view controller. UIViewControllerPreviewingDelegate Protocol Reference is used to define peek and if screen is hard pressed, it shows preview of the view. Below is mentioned the demo snippet for peek and pop actions.
let contactName = "Robert Garero" var icon: UIApplicationShortcutIcon? = nil self.requestForAccess { (true) in let predicate = CNContact.predicateForContacts(matchingName: contactName) let contacts = try? CNContactStore().unifiedContacts(matching: predicate, keysToFetch: []) if let contact = contacts?.first { icon = UIApplicationShortcutIcon(contact: contact) } } let type = "com.company.app.sendChatTo" let subtitle = "Send a chat" let shortcutItem1 = UIApplicationShortcutItem(type: type, localizedTitle: contactName, localizedSubtitle: subtitle, icon: icon, userInfo: nil) let shortcutitems = [shortcutItem1] UIApplication.shared.shortcutItems = shortcutitems |
let contactName = “Robert Garero”
var icon: UIApplicationShortcutIcon? = nil
self.requestForAccess { (true) in
let predicate = CNContact.predicateForContacts(matchingName: contactName)
let contacts = try? CNContactStore().unifiedContacts(matching: predicate, keysToFetch: [])
if let contact = contacts?.first {
icon = UIApplicationShortcutIcon(contact: contact)
}
}
let type = “com.company.app.sendChatTo”
let subtitle = “Send a chat”
let shortcutItem1 = UIApplicationShortcutItem(type: type, localizedTitle: contactName, localizedSubtitle: subtitle, icon: icon, userInfo: nil)
let shortcutitems = [shortcutItem1]
UIApplication.shared.shortcutItems = shortcutitems
The messages previewed are not marked as read. Also, if arrow is available at the top – means additional power shortcuts like reply, save or add to read later are available. Even like or dislike can be done and replies or comment can also be mentioned.
Pressure and Intensity Sensitivity
UITouch class’s properties force and maximumPossibleForce are used to detect the touch pressure and accordingly, the app responds. iPhone app developers use this class for performing touch effective event like dragging icon or keyboard text selection or tapping a link or image and adding to read later list.
All above this, 3D Touch accessibility is optional for a user. User can disable 3D Touch. User can also set 3D Touch sensitivity from Light, Medium and Firm.
3D Touch indeed came up with a revolution in mobile app development. Right from built-in apps to social media apps and image editing apps have adopted this technique in their iPhone applications. 3D Touch refined the basic features and let users have quick access to the apps.
Vishal Shah
Vishal Shah has an extensive understanding of multiple application development frameworks and holds an upper hand with newer trends in order to strive and thrive in the dynamic market. He has nurtured his managerial growth in both technical and business aspects and gives his expertise through his blog posts.
Subscribe to our Newsletter
Signup for our newsletter and join 2700+ global business executives and technology experts to receive handpicked industry insights and latest news
Build your Team
Want to Hire Skilled Developers?
Comments
Leave a message...