3D Touch(Quick Actions) in iOS

3D Touch is a simple and useful feature released in iOS 9. For now it is supported in iPhone 6s and 6s+. Also some of the iOS default apps like Calendar, Message, Photos, Safari etc., use this feature. The user can turn ON/OFF this feature through iOS default settings.

3D Touch ON/OFF: 

To ON/OFF the 3D Touch, open Settings then go to General > Accessibility > 3D Touch.

Quick Actions Usage: 

Quick Actions let you do the things you do, most often faster and in fewer steps. For accessing the Quick Actions you have to force touch the app icon in home screen. It will pop up a menu with a list of shortcuts. By choosing any of the shortcuts, we can directly navigate to the corresponding screen in the app.

Bitmap + Bitmap1

What you can do with Quick Actions?

1. Shooting video, selfies and more

Press the Camera icon on the Home screen, and you can immediately snap a selfie, shoot a video, or even go straight into a  camera mode, such as slo-mo.

2. Reading list, Bookmarks, Private Tab and much more

Press the Safari icon on the Home Screen and you can choose any of the four options i)Show Reading List, ii)Show Book Marks iii) New Private Tab and iv) New Tab listed from Safari icon. By choosing the option “New Tab”, it directly navigate to the new tab page.

How can a developer implement the Quick Actions feature in his own app?

From Xcode 7 you can develop the Quick Actions feature for your own apps. You cannot test the Quick Actions feature directly in simulator. For that you have to do some tricks. I’ve explained this in detail below in the section “How to test Quick Actions?”

Step 1:  Create a new iOS application.

Step 2:  In the app info.plist add the key “UIApplicationShortcutItems” as NSArray. In the array you have to add a item as NSDictionary type.

Step 3: In the NSDictionary we have to add 2 fields as mandatory field:

i) UIApplicationShortcutItemType —> We have to specify the shortcut item type. By using this type we can handle our quick actions inside our app.

ii) UIApplicationShortcutItemTitle —> This is the title of the option, listed in home screen icon.

Step 4:  Also we can specify some of the additional types in NSDictionary like UIApplicationShortcutItemSubtitle, UIApplicationShortcutItemIconType, UIApplicationShortcutItemIconFile and UIApplicationShortcutItemUserInfo.

Each of the fields have some specific functions.

For detailed implementation process of UIApplicationShortcutItems check out this link iPhoneOSKeys.html

Refer the below image, on how to add UIApplicationShortcutItems in the app info.plist. Also I have attached a source code image for UIApplicationShortcutItems key.

Bitmap2

Bitmap3

Note:

We can also add the UIApplicationShortcutItems dynamically. You can refer this in IOS default Message app. First option is to create a new message and other three options are dynamically added. The other three options are the latest three message users.

Bitmap4

Testing Quick Actions:

In simulator we cannot test this feature and as an individual developer, we cannot always buy the latest device for development process. In this situation we cannot debug/test the Quick Actions feature fully.

For testing the Quick Actions in simulator, we have to do some tweaks. 

For tweaking the Quick Actions feature in simulator, download the “SBShortcutMenuSimulator” from Github.

Follow the steps given in the Github page. In case it doesn’t work, then reset your simulator and try again. It will work as expected.

Note:

When testing the 3D touch in devices, make sure that the 3D touch option is enabled in iOS general settings.

Yogesh,
iOS Team Lead,
Mallow Technologies.

1 Comment

  1. Srinivas

    Wow, superb dube… Keep Rocking…

Leave a Comment

Your email address will not be published. Required fields are marked *