Documentation

    Configuration Options

    You can customize the behavior of the Co-Browsing API iOS SDK through configuration options.

    Setting Configuration

    Pass options when creating the UpscopeConfiguration:

    let config = UpscopeConfiguration(
        apiKey: "YOUR_API_KEY",
        requireAuthorizationForSession: true,
        authorizationPromptTitle: "Screen Sharing Request",
        authorizationPromptMessage: "Allow {%agentName%|Support} to view your screen?",
        endOfSessionMessage: "Thanks for using screen sharing!",
        translationsYes: "Allow",
        translationsNo: "Decline"
    )
    
    try Upscope.shared.initialize(with: config)
    

    Configuration Options

    Each option resolves in this order: a value you pass here overrides the matching dashboard setting, which overrides the SDK's built-in default (shown in the Default column).

    Session Authorization

    OptionTypeDefaultDescription
    requireAuthorizationForSessionBool?trueRequire user permission before screen sharing starts. Resolved from the value set here, else the team's dashboard setting, else true. When it resolves false, sessions start silently and onSessionRequest is not called.
    authorizationPromptTitleString?(Set through the admin interface)Custom title for the authorization dialog.
    authorizationPromptMessageString?(Set through the admin interface)Custom message for the authorization dialog. Supports placeholders.

    Message Placeholders

    The authorizationPromptMessage supports these placeholders:

    • {%agentName%|fallback} - Agent's name with a fallback if unavailable
    • {%currentDomain%} - App name on iOS

    Example:

    authorizationPromptMessage: "{%agentName%|Our support team} would like to view your screen"
    

    UI Display

    OptionTypeDefaultDescription
    showTerminateButtonBool?(Set through the admin interface)Show a button to end the screen sharing session.
    showUpscopeLinkBool?trueShow the Co-Browsing API link to the user. Setting this to false only works if whitelabeling is included in your plan.
    endOfSessionMessageString?(Set through the admin interface)Message displayed when the session ends.
    stopSessionTextString?(Set through the admin interface)Custom text for the stop session button.

    Remote Control

    OptionTypeDefaultDescription
    allowRemoteClickBool?(Set through the admin interface)Allow agents to remotely tap on the screen.
    allowRemoteScrollBool?(Set through the admin interface)Allow agents to remotely scroll the screen.
    requireControlRequestBool?falseRequire user approval before agents can use remote input. Resolved from the value set here, else the team's dashboard setting, else false. When it resolves false, remote input is granted without a separate control request.
    controlRequestTitleString?(Set through the admin interface)Custom title for the control request prompt.
    controlRequestMessageString?(Set through the admin interface)Custom message for the control request prompt.
    onControlRequest((SessionRequestResponse, String?) -> Cancellable?)?(Custom UI)Called when an agent requests remote control. Only invoked when requireControlRequest is enabled (which defaults to false). The closure receives the response and the requesting agent's name (may be nil). Show your own UI, then call response.accept() or response.reject(). When unset, the SDK shows its default control request prompt. See Custom Authorization UI.

    Lookup Code

    OptionTypeDefaultDescription
    enableLookupCodeOnShakeBool?(Set through the admin interface)Show lookup code popup when device is shaken.
    lookupCodeKeyTitleString?(Set through the admin interface)Custom title for the shake detection alert.
    lookupCodeKeyMessageString?(Set through the admin interface)Custom message for shake alert. Supports {%lookupCode%} placeholder.

    Localization Strings

    OptionTypeDescription
    translationsYesString?Custom text for "Allow" button in authorization prompt.
    translationsNoString?Custom text for "Deny" button in authorization prompt.
    translationsOkString?Custom text for "OK" button.

    Multi-Language Translations

    Every text option (titles, messages, and the strings above) also accepts a dictionary keyed by language code instead of a single string. The translation matching the device language is shown, falling back to en if the device language isn't included:

    translationsYes: ["en": "Yes", "it": "Si"],
    translationsNo: ["en": "No", "it": "No"]
    

    All of these can also be configured per language through the dashboard.

    Full Device Screen Sharing

    OptionTypeDescription
    allowFullScreenBool?Allow agents to request full device screen sharing during sessions. Also requires the setup described in Full Device Screen Sharing. Default: (Set through the admin interface).
    disableFullScreenWhenMaskedBool?When true, full device screen sharing is automatically declined if any masked views are present. Default: (Set through the admin interface).
    onFullDeviceRequest((SessionRequestResponse, String?) -> Cancellable?)?Called when an agent requests full-device sharing, before the system broadcast picker appears. The closure receives the response and the requesting agent's name (may be nil). Show your own UI, then call response.accept() to continue to the picker or response.reject() to decline. When unset, the SDK proceeds to the picker directly.

    See Full Device Screen Sharing for the full setup guide.

    System Options

    OptionTypeDescription
    autoconnectBool?Automatically connect on initialization. Default: true (set through the admin interface).
    regionString?Server region for connections.
    onPremiseBaseEndpointString?The base endpoint of your on-premise deployment (your instance's BASE_ENDPOINT), e.g. "https://cobrowsing.acmetech.com". When set, the SDK connects to your instance instead of the cloud servers, and region is ignored.
    webviewMaskedElements[String]?List of CSS selectors (e.g. [".credit-card"]) to redact inside WebViews enrolled with redactWebView. Merged with the dashboard Masked elements setting and with selectors passed to redactWebView; a local list never disables dashboard masking.

    Custom Authorization UI

    onSessionRequest is only invoked when requireAuthorizationForSession resolves true — when authorization is disabled (locally or via the team's dashboard setting), sessions start without any prompt and the handler is never called.

    You can replace the default authorization dialog with your own UI by setting the onSessionRequest property after creating the configuration:

    var config = UpscopeConfiguration(
        apiKey: "YOUR_API_KEY",
        requireAuthorizationForSession: true
    )
    
    config.onSessionRequest = { response, agentName in
        // Show your custom UI here
        // Call response.accept() or response.reject()
        myCustomAlert.show(agentName: agentName) { accepted in
            if accepted {
                response.accept()
            } else {
                response.reject()
            }
        }
        // Return a Cancellable for cleanup if the request is dismissed externally
        return Cancellable {
            myCustomAlert.dismiss()
        }
    }
    
    try Upscope.shared.initialize(with: config)
    

    Similarly, use onControlRequest to customize the remote control authorization prompt:

    var config = UpscopeConfiguration(
        apiKey: "YOUR_API_KEY",
        requireControlRequest: true
    )
    
    config.onControlRequest = { response, agentName in
        // Show your custom UI, e.g. "{agentName} wants to control your screen"
        myControlAlert.show(agentName: agentName) { accepted in
            if accepted {
                response.accept()
            } else {
                response.reject()
            }
        }
        return nil // or return a Cancellable
    }
    

    Use onFullDeviceRequest to intercept full-device sharing requests before the system broadcast picker appears:

    var config = UpscopeConfiguration(
        apiKey: "YOUR_API_KEY"
    )
    
    config.onFullDeviceRequest = { response, agentName in
        // Show your custom UI before the system broadcast picker
        myCustomAlert.show(agentName: agentName) { accepted in
            if accepted {
                response.accept() // proceeds to the system broadcast picker
            } else {
                response.reject() // declines without showing the picker
            }
        }
        // Return a Cancellable called if the request is dismissed externally
        return Cancellable {
            myCustomAlert.dismiss()
        }
    }
    
    try Upscope.shared.initialize(with: config)
    

    Full Example

    let config = UpscopeConfiguration(
        apiKey: "YOUR_API_KEY",
        requireAuthorizationForSession: true,
        authorizationPromptTitle: "Screen Share",
        authorizationPromptMessage: "{%agentName%|Support} wants to help you",
        showTerminateButton: true,
        endOfSessionMessage: "Session ended. Thank you!",
        stopSessionText: "End Session",
        allowRemoteClick: true,
        allowRemoteScroll: true,
        enableLookupCodeOnShake: true,
        lookupCodeKeyTitle: "Your Code",
        lookupCodeKeyMessage: "Share this code: {%lookupCode%}",
        translationsYes: "Yes, share",
        translationsNo: "No thanks",
        translationsOk: "Got it",
        region: "us-east"
    )
    
    try Upscope.shared.initialize(with: config)