Skip to main content

🔗 Custom URL handler

Tags: iOS

In certain applications, having granular control over how hyperlinks are managed is crucial. This document outlines how to override the default URL handling behavior in your iOS app using the Gleap framework. By configuring a custom URL handler, you delegate the responsibility of opening URLs from the Gleap framework to a handler of your choosing. This allows for tailored handling of URL interactions based on the specific needs of your application.

Configure the URL handler

Use our GleapDelegate protocol. This protocol includes the method that handles URL loading:

import Foundation
import UIKit
import Gleap

// Add the GleapDelegate protocol to your view controller
class DemoViewController: UIViewController, GleapDelegate {

override func viewDidLoad() {
// Assign self to the delegate
Gleap.sharedInstance().delegate = self;
}

func openExternalLink(_ url: URL) {
// Handle url
}
}