Skip to main content

Setup and Integration

How to add the Survey Engine (KMP) as a dependency in your project.

Prerequisites

  • JDK 17+ — required for JVM builds
  • Gradle 8.10+ — build system
  • Kotlin 2.1+ — language version

Installation

The library is published via JitPack.

Step 1: Add the JitPack repository

// settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven { url = uri("https://jitpack.io") }
}
}

Or in your module's build.gradle.kts:

repositories {
maven { url = uri("https://jitpack.io") }
}

Step 2: Add the dependency

dependencies {
implementation("com.github.qlarr-surveys:survey-engine-kmp:0.1.6")
}

Platform Targets

The library supports three platform targets:

PlatformTargetJS Engine
JVMjvm()GraalVM JavaScript (sandboxed)
JavaScriptjs(IR) — browser and Node.jsNative eval
iOSiosX64, iosArm64, iosSimulatorArm64JavaScriptCore

iOS (CocoaPods)

For iOS projects, the library is available as a CocoaPods framework:

pod 'surveyengine', :path => '<path-to-library>'

Before running pod install, generate the framework:

./gradlew :surveyengine:generateDummyFramework

API Overview

The library exposes two main entry points:

ValidationUseCaseWrapper (design time)

Used to process and validate a survey definition:

val wrapper = ValidationUseCaseWrapper.create(surveyJson)
val result = wrapper.validate() // returns processed survey JSON

Used to navigate a survey during execution:

val wrapper = NavigationUseCaseWrapper(
processedSurvey = processedSurveyJson,
values = existingResponses, // default: "{}"
navigationMode = NavigationMode.GROUP_BY_GROUP,
navigationDirection = NavigationDirection.Start,
navigationIndex = null,
lang = "en",
skipInvalid = true,
surveyMode = surveyMode
)

Key Types

  • NavigationModeALL_IN_ONE, GROUP_BY_GROUP, QUESTION_BY_QUESTION
  • NavigationDirectionStart, Next, Previous, Resume, Save, Jump
  • NavigationIndex — identifies the current position (group, question, or end)

Building from Source

git clone https://github.com/qlarr-surveys/survey-engine-kmp.git
cd survey-engine-kmp
./gradlew build

Running Tests

./gradlew allTests

Platform-specific tests:

./gradlew jvmTest
./gradlew jsTest
./gradlew iosX64Test