It is a very useful feature on iOS that allows the users to navigate to a specific part of an app instead of going through the normal navigation flow. This helps to improve user experience, makes possible the launching of marketing campaigns while making connections with external systems such as email or social networking.
1. Custom URL Schemes:
2. Universal Links:
Custom URL Schemes
1. Adding a URL Scheme to Your Application:
Open your app's target in Xcode. Under the Info tab, you'll find URL Types. Here, add your custom scheme (for example, myapp).
2. let your AppDelegate handle the deep link:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
guard let scheme = url.scheme, scheme == "myapp" else { return false }
// Parse URL and navigate to the appropriate screen
return true
}
Universal Links
1. Set up an Apple app site association file (.aasa):
{
"applinks": {
"apps": [],
"details": [
{
"appID": "<TeamID>.<BundleID>",
"paths": ["/path/*"]
}
]
}
}
2. Enable Associated Domains in Xcode:
3. Then proceed to manage the link via SceneDelegate (or App in SwiftUI):
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL else { return }
// Parse URL and navigate to the appropriate screen
}
xcrun simctl openurl booted myapp://path
xcrun simctl openurl booted https://yourdomain.com/path
Deep linking is one of the features all modern iOS apps should have to ensure that users are kept interested and navigated easily. A combination of custom URL schemes and universal links should give you the right strategy for robust deep linking based on the requirements of your app.
Ready to transform your business with our technology solutions? Contact Us today to Leverage Our iOS Expertise.