Start a Project

Implement Application Shortcut in App using swift 4

Application Shortcut

Application shortcut is the way where we can perform some task fast without open the main App & go to particular section . App Shortcut will directly to specified location , but there is some limitation to use this Shortcut it will support to iPhone 6s to above phone .

There is Some Steps to Follow.

1: Open Your App Delegate File .

a: Here I have taken one shortcut that will go to your Cart Controller in App.

declare their unique key : it is unique key to define the App Shortcut that will help to update this name or other value later .

b: Go to this Function in App Delegate file and write this:

c: Now we have to define this method:

Note: Here we are checking the App Shortcut is Created before or not so if is empty than it will create other wise return the previous one.

d: Declare Shortcut Item in Appdelegate.swift class:

2: Handle the Click Event Of App Shortcut.

a: Override this method in App Delegate file:

Note: If you click on Any Shortcut item , this method will automatically call so you need to return true for successfully execution.

Here i have taken Local Notification to handle the request.

You have to define this “shortcutsearchtap” in your start viewcontroller in ViewDidload Method.

In Our Case i have start viewcontroller is ViewController.swift class.

That’s All
For any queries, feel free to ask.

Exit mobile version