Logo

Deep Linking

EcoCoordinator provides built-in methods for checking and handling Birbonus deep links.

Deep-Link Methods

public extension EcoCoordinator {
    /// Returns true when the URL can be handled by Birbonus.
    func canHandle(_ url: URL) -> Bool

    /// Handles a supported Birbonus deep link.
    /// The optional completion handler receives the navigation result.
    func handle(
        _ url: URL,
        completion: ((Bool) -> Void)? = nil
    )
}

Handling an Incoming URL

func application(
    _ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
    guard coordinator.canHandle(url) else {
        // The URL is not a Birbonus deep link.
        // Handle it in the host application.
        return false
    }

    coordinator.handle(url) { success in
        if success {
            print("Deep link handled successfully")
        } else {
            print("Failed to handle deep link")
        }
    }

    return true
}

Deep-Link Requirements

  • Configure the host application to receive the required URL or universal-link types before using these methods.
  • Always call canHandle(_:) before passing a URL to handle(_:).
  • A true result means the SDK recognizes the URL.
  • A false result means the host application must handle the URL itself.
  • The SDK parses a supported URL and navigates to the corresponding destination.
  • The completion handler is optional and returns true when navigation succeeds.