YourCX iOS SDK

The YourCX iOS SDK provides a seamless integration for managing and displaying surveys within your iOS application. This document covers requirements, installation, initialization and available API for using the SDK effectively.

Requirements

  • Requires Xcode 16.0 or above
  • Requires iOS 16.0 or above

Installation

You can add the following dependency to your Package.swift:

//TODO: url will be provided later

Initialization

In AppDelegate, setup the YourCX object by specifying the parameters:

  • apiKey - A unique key provided by the YourCX, required for authentication and access to the API.
  • clientId - A unique identifier can be found in the YourCX dashboard and is required for authentication and API access.
  • locale - The language and region code in which the content should be displayed, following the IETF BCP 47 format (e.g., "en-US", "pl-PL")
  • enviroment - Defines the API environment to be used. Acceptable values are production for live usage and stage
YourCX.shared.setup(apiKey: "API_KEY",
                  clientId: "CLIENT_ID",
                    locale: Locale.current,
                enviroment: .production)

Set the DEBUG flag to true to enable debug mode.

    YourCX.shared.enableDebug = true

Integration

YourCX enables you to deploy highly targeted surveys within your app. Through the YourCX dashboard, you can configure specific conditions groups that must be fulfilled for surveys to be displayer. When the app state meet the conditions set in the YourCX panel, the survey will automatically appear on the screen.

Targeting survey by screen name

In YourCX dashboard you will be able to specify a list of screens that SDK will take into consideration when deciding whether the survey should be displayed. YourCX SDK recognizes the screen by it's ID. To set it up in the application, you need to tell the SDK when the user enters and leaves the screen.

Examples

UIKit

import UIKit
import YourCxSDK

class ViewController: UIViewController {

    let screenName = "SCREEEN_ID"    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // ...
        YourCX.shared.enterScreen(screenName: screenName)
    }

    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        
        YourCX.shared.leaveScreen(screenName: screenName)
    }

SwiftUI

Supported screens

If you need, you can get supported screens:

    try? YourCX.shared.getSupportedScreens()

This method return array of Strings

Additional parameters

In addition to visiting screens, YourCX SDK offers an option to provide additional parameters to be checked as a condition to display a survey. In order to add parameter, use:

    let additionalParameter = AdditionalParam(key: "key",
                                           values: ["value_1", "value_2"])
    YourCX.shared.addAdditionalParam(additionalParameter)

It is also possible to read currently set parameters:

    YourCX.shared.getAdditional()

This method return array of AdditionalParams

Audit Survey

While you can rely on our middleware to decide when to open certain survey, it can also be opened on-demand by using:

    YourCX.shared.openSurvey(surveyId: "survey_ID",
               modalPresentationStyle: .automatic,
                           completion: { error in })

Please note that only surveys of the type 'Audit' can be opened this way.

2025 ©
YourCX. All rights reserved
Design:
Proformat