Docs

iOS

Migrate your iOS app from Firebase Dynamic Links to Grovs for deep linking, universal link handling, and more.

Overview

This guide will help you migrate from Firebase Dynamic Links to Grovs for deep linking, universal link handling, event tracking and more.

Prerequisites

  • You have an active Grovs account and have integrated the Grovs SDK into your project.
  • Your app previously used Firebase Dynamic Links and you are now transitioning to Grovs.

Key Steps in Migration

To ensure full functionality, you'll need to replace Firebase Dynamic Links methods with their Grovs equivalents. Below are the detailed steps.

1. Initialization

Firebase Dynamic Links doesn't require explicit initialization for link handling but needs Firebase initialized.

Grovs

Grovs is initialized using application:didFinishLaunchingWithOptions. Here you must also provide yourDelegate which is a delegate for handling your deeplinks.

Swift
import Grovs
 
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: yourDelegate)
    Grovs.setDebug(level: .info)
    return true
}

Replace the associated domains from Xcode project > Target > Signing & Capabilities of the Firebase Dynamic Links with the one from Grovs dashboard.

Then there are two ways in which you can let Grovs handle incoming links:

AppDelegate Approach

Firebase Dynamic Links:

Swift
func application(_ application: UIApplication, continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    guard let incomingURL = userActivity.webpageURL else { return false }
    let handled = DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { dynamicLink, error in
        // Handle dynamic link
    }
    return handled
}
 
func application(_ application: UIApplication, open url: URL,
                 options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
    return DynamicLinks.dynamicLinks().handleUniversalLink(url) { dynamicLink, error in
        // Handle dynamic link
    }
}

Grovs:

Swift
func application(_ application: UIApplication, continue userActivity: NSUserActivity,
                 restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    return Grovs.handleAppDelegate(continue: userActivity, restorationHandler: restorationHandler)
}
 
func application(_ app: UIApplication, open url: URL,
                 options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
    return Grovs.handleAppDelegate(open: url, options: options)
}

SceneDelegate Approach

If your app uses a Scene Delegate (iOS 13+), you need to forward universal links and URLs to Grovs in the SceneDelegate:

Firebase Dynamic Links:

Swift
@available(iOS 13.0, *)
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    guard let url = userActivity.webpageURL else { return }
    DynamicLinks.dynamicLinks().handleUniversalLink(url) { dynamicLink, error in
        // Handle dynamic link
    }
}

Grovs:

Swift
// Handle open URL contexts
@available(iOS 13.0, *)
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    Grovs.handleSceneDelegate(openURLContexts: URLContexts)
}
 
// Handle continue user activity
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    Grovs.handleSceneDelegate(continue: userActivity)
}
 
// Handle scene delegate options
@available(iOS 13.0, *)
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    Grovs.handleSceneDelegate(options: connectionOptions)
}
Swift
guard let link = URL(string: "https://www.example.com/") else { return }
 
let dynamicLinkComponents = DynamicLinkComponents(link: link, domainURIPrefix: "https://example.page.link")
// iOS parameters
dynamicLinkComponents?.iOSParameters = DynamicLinkIOSParameters(bundleID: "com.example.ios")
// Android parameters
dynamicLinkComponents?.androidParameters = DynamicLinkAndroidParameters(packageName: "com.example.ios")
// Social meta-tag parameters
dynamicLinkComponents?.socialMetaTagParameters = DynamicLinkSocialMetaTagParameters()
dynamicLinkComponents?.socialMetaTagParameters?.title = "Welcome to My App!"
dynamicLinkComponents?.socialMetaTagParameters?.descriptionText = "Some social description."
dynamicLinkComponents?.socialMetaTagParameters?.imageURL = URL(string: "https://www.example.com/images/social_preview.png")
 
// Build the short link
dynamicLinkComponents?.shorten(completion: { (shortURL, warnings, error) in
    if let error = error {
        // Error
        return
    }
 
    if let shortURL = shortURL {
        // Link created
    }
})

Grovs

Grovs simplifies link creation by having all the configurations on the Grovs dashboard so developers can focus just on link generation.

Swift
Grovs.generateLink(title: "Welcome to My App!",
                   subtitle: "Some social description.",
                   imageURL: "https://www.example.com/images/social_preview.png", data: nil, tags: nil) { url in
    // Link created
}

4. User Identification and Attributes

Firebase uses FirebaseAuth for identity.

Grovs

Swift
Grovs.userIdentifier = "user123"
Grovs.userAttributes = ["name": "Alice Smith", "tier": "Premium"]

Notes for Migration

  • Smooth transition: Grovs can work alongside Firebase and Firebase Dynamic Links. In some cases it might make sense to keep both integrations for a period to have a smooth transition.
  • Simplified SDK: Grovs is designed for minimal boilerplate and faster integration in iOS apps while keeping the configurations one click away in the dashboard.