3D Touch: Quick Actions

Can Akkaya
2 min readMar 18, 2020

--

How to add quick actions to your iOS app

Photo by Daniel Korpai on Unsplash

The 3D Touch technology was first introduced on the iPhone 6s and iPhone 6s Plus. Devices supporting 3D Touch are equipped with a tap force sensitive display, measuring the pressure on the screen. This technology provides us some advantages. One of these advantages is quick actions.

Quick actions can be used by deep 3D press on the app icon in iOS device home screen. There are two ways to add a quick action for apps: Static and Dynamic.

Static

Static actions are defined in the Info.plist file within the UIApplicationShortcutItems array.

  • UIApplicationShortcutItemIconType optional string which defines built-in icon type.
  • UIApplicationShortcutItemTitle title of your action.
  • UIApplicationShortcutItemSubtitle optional subtitle of your action.
  • UIApplicationShortcutItemType app-specific string that you employ to identify the type of quick action to perform. It can be used in code to handle actions for different shortcut types.

Info.plist file should be like the following.

Dynamic

If you want to create dynamic quick actions, you should create UIApplicationShortcutItem then assign to your application’s shortcutItems property like this:

When you select any item from menu it will call appDelegate’s performActionFor shortcutItem function. You can handle quick actions in this function as follows:

Thanks for reading.

--

--