Universal links

Handle tap on in-person appointments addresses

Open appointments address in other applications

Users can tap the address of an in-person appointment in the details or the confirmation screens to open it in other applications.

By default, our SDK can use Apple Maps and Google Maps applications.

NablaClient.shared.scheduling.universalLinkGenerators = [
    GoogleMapsUniversalLinkGenerator(allowOpeningInWebBrower: false),
    AppleMapsUniversalLinkGenerator()
]

Apple Maps integration

iOS does not tell us if the Apple Maps app is installed on the user's device. The option will therefore always be shown to the user, and it will use the browser if the app is not installed.

You can decide to completely remove the Apple Maps option by overriding the NablaClient.shared.scheduling.universalLinkGenerators without passing the AppleMapsUniversalLinkGenerator.

Google Maps integration

By default, our SDK will show the Google Maps option only when the app is installed on the user's device. To do so, you need to whitelist a new URL scheme in your info.plist so that the SDK can detect if the app is installed on the device. Add a new item comgooglemaps under LSApplicationQueriesSchemes.

You can decide to always show it, and default to the browser when the app is not installed. To do so, override the NablaClient.shared.scheduling.universalLinkGenerators:

NablaClient.shared.scheduling.universalLinkGenerators = [
    GoogleMapsUniversalLinkGenerator(allowOpeningInWebBrower: true),
    AppleMapsUniversalLinkGenerator(),
]

You can also decide to completely remove the Google Maps option by overriding the NablaClient.shared.scheduling.universalLinkGenerators without passing the GoogleMapsUniversalLinkGenerator.

Custom integrations

The minimum requirement to create your own integration is to implement the UniversalLinkGenerator interface. But we recommend implementing MapAppUniversalLinkGenerator instead. It requires to write less code and has the detection of installed applications built-in.

/// A type of ``UniversalLinkGenerator`` designed to open addresses in an app installed on the user's device.
public protocol MapAppUniversalLinkGenerator: UniversalLinkGenerator {
    /// The name used when listing the apps eligible to open the address.
    var displayName: String { get }
    /// The URL scheme of the app to open. It must be registered under `LSApplicationQueriesSchemes` in your info.plist file.
    /// If you don't want to open an application and only care about the web brwoser, you can return nil.
    var applicationUrlScheme: URL? { get }
    /// Wether the SDK should open the web browser instead of the app when not installed.
    var allowOpeningInWebBrower: Bool { get }
    /// The universal link or url scheme link to open for the `Address`.
    /// Make sure to provide a universal link if you want the browser support when the application is not installed.
    /// Each application uses a different format for the query. Refer to their documentation to implement this method.
    func makeQueryUrl(address: Address) -> URL?
}

Similar to the Google Maps integration, you will need to register a new url scheme under LSApplicationQueriesSchemes for each application you want to integrate.