Deeplink

You can embed a deep link in Leap's Instruction i.e. buttons, texts etc. Once tapped will take the user to the specified page/screen in your app.

Set-Up

Add URL Scheme in your project:
Step 1: Open yourproject.xcodeproj. Under targets, select your app and go to info section.
Step 2: Scroll down to see URL Types and click on '+' button to add one.
Step 3: Add your app's name or any desired name in the URL Schemes field. (This is your schemeName)
Step 4: Add your app's bundle identifier or any unique identifier in the identifier field (Optional, not required)
Below iOS 13:
Step 1: Add open url method in AppDelegate.swift file just like shown below.
Step 2: In the dashboard, make sure to use the format schemeName://pageName. Ex: demoApp://profile (Example is shown below under flowmenu section on how to add deeplink in dashboard)
Step 3: If the schemeName in your project URL Schemes match with the dashboard schemeName, the user will be redirected to the below method.
If you have a profile page and you want to add deep link capability to that, follow the example below:
// AppDelegate.swift
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : An] = [:]) -> Bool {
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
let host = components.host else {
return false
}
// Extract host. Host is your pageName. Based on the host name, navigate to the
// desired view or view controller like below or you can do in your way based
// on your app's architecture.
guard let deeplink = DeepLink(rawValue: host) else {
return
}
mainController?.handleDeeplink(deeplink)
return true
}
// global type
enum DeepLink: String {
case home
case profile
}
// MainController.swift
func handleDeeplink(_ deeplink: DeepLink) {
switch deeplink {
case .home:
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "HomeViewController") as? HomeViewController
self.navigationController?.pushViewController(vc!, animated: true)
case .profile:
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "ProfileViewController") as? ProfileViewController
self.navigationController?.pushViewController(vc!, animated: true)
}
}
iOS 13 and Above:
Step 1: Add open URLContexts method in SceneDelegate.swift file just like shown below. ****
Step 2: In the dashboard, make sure to use the format schemeName://pageName. Ex: demoApp://profile (Example is shown below under flowmenu section on how to add deeplink in dashboard)
Step 3: If the schemeName in your project URL Schemes match with the dashboard schemeName, the user will be redirected to the below method.
If you have a profile page and you want to add deep link capability to that, follow the example below:
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else { return }
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
let host = components.host else {
return
}
// Extract host. Host is your pageName. Based on the host name, navigate to the
// desired view or view controller like below or you can do in your way based
// on your app's architecture.
guard let deeplink = DeepLink(rawValue: host) else {
return
}
mainController?.handleDeeplink(deeplink)
}
// global type
enum DeepLink: String {
case home
case profile
}
// MainController.swift
func handleDeeplink(_ deeplink: DeepLink) {
switch deeplink {
case .home:
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "HomeViewController") as? HomeViewController
self.navigationController?.pushViewController(vc!, animated: true)
case .profile:
let vc = UIStoryboard.init(name: "Main", bundle: Bundle.main).instantiateViewController(withIdentifier: "ProfileViewController") as? ProfileViewController
self.navigationController?.pushViewController(vc!, animated: true)
}
}
When configuring a Flow Menu (i.e. Walkthrough Checklist/Walkthrough Menu), for a particular menu item you can add a deep link. It is helpful when a particular menu item of the Flow Menu is configured on a different page (not the same as the start screen). With the help of deep-link, Leap can navigate to the required page. Let's see how we can add the deep link in Leap Dashboard

Let's take the example of the Walkthrough Checklist:

Suppose the menu item Profile is configured on a different page (not the same as start-screen). To navigate to the required page, you can add the deep link for that by clicking on Profile. Once you click, you will see a DEEPLINK section on right. Add your configured deep-link URL there.
Above image shows adding deep link in dashboard with the format schemeName://pageName