iOS
Migrate your iOS app from Firebase Dynamic Links to Grovs for deep linking, universal link handling, and more.
Replace each Firebase Dynamic Links call in your iOS app with its Grovs equivalent.
Before you start: you need a Grovs account and the Grovs SDK in your project. See the iOS SDK guide.
Steps
1. Initialization
Firebase Dynamic Links
No explicit initialization for link handling, but Firebase itself must be initialized.
Grovs
Configure Grovs in application:didFinishLaunchingWithOptions, passing yourDelegate to handle deep links.
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
}2. Universal Links and URL Handling
In Xcode project > Target > Signing & Capabilities, replace the Firebase associated domains with the ones from the Grovs dashboard. Then forward incoming links from the AppDelegate or the SceneDelegate.
AppDelegate Approach
Firebase Dynamic Links:
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:
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
Apps with a Scene Delegate (iOS 13+) forward Universal Links and URLs there:
Firebase Dynamic Links:
@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:
// 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)
}3. Generating Links
Firebase Dynamic Links
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
Platform parameters live in the Grovs dashboard, so the call only sets the link's content.
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 Dynamic Links
Firebase uses FirebaseAuth for identity.
Grovs
Grovs.userIdentifier = "user123"
Grovs.userAttributes = ["name": "Alice Smith", "tier": "Premium"]Running both during the transition
Grovs works alongside Firebase and Firebase Dynamic Links. You can keep both integrations for a while to phase the switch.