Skip to main content
The MobileBoost SDK for XCUI integrates directly with XCUIApplication, adding self-healing and AI commands to your native iOS tests.

Installation

Add the gptd_swift package to your Xcode project’s UI testing target via Swift Package Manager:
  1. In Xcode, go to your project settings
  2. Select your UI test target
  3. Click Add Dependencies
  4. Enter the package URL: https://github.com/MobileBoostHQ/gptd-swift

Configuration

Native XCUITest

Import the package and initialize GptDriver in your test’s setUp method:
import XCTest
import gptd_swift

@MainActor
final class DemoUITests: XCTestCase {

    var app: XCUIApplication!
    var gptDriver: GptDriver!

    override func setUpWithError() throws {
        continueAfterFailure = false

        app = XCUIApplication()
        app.launch()

        gptDriver = GptDriver(
            apiKey: "<YOUR_API_KEY>",
            nativeApp: app
        )
    }

    override func tearDownWithError() throws {
        app = nil
    }
}

Caching

To optimize execution time, enable caching so AI is only used when the test definition or app changes.
ModeDescription
NONENo caching
FULL_SCREENCache hit only if the full screen matches a previous successful execution
INTERACTION_REGIONCache hit if the interaction region matches (recommended)
Set caching in the constructor:
gptDriver = GptDriver(
    apiKey: "<YOUR_API_KEY>",
    nativeApp: app,
    cachingMode: CachingMode.interactionRegion,
    testId: self.name
)
You can also override the caching mode per step for fine-grained control.