📇All Dependencies

Add Maven

If you don't already have Maven Central in your repositories yet, add the following:

// settings.gradle.kts

pluginManagement {
    repositories {
        mavenCentral()
        // etc
    }
}

dependencyResolutionManagement {
    repositories {
        mavenCentral()
        // etc
    }
}

Add Compass dependencies

  1. Declare the dependencies in your libs.versions.toml:

[versions]
compass = "1.2.2"

[libraries]
compass-autocomplete = { module = "dev.jordond.compass:autocomplete", version.ref = "compass" }
compass-autocomplete-mobile = { module = "dev.jordond.compass:autocomplete-mobile", version.ref = "compass" }
compass-autocomplete-web = { module = "dev.jordond.compass:autocomplete-web", version.ref = "compass" }
compass-autocomplete-geocoder-googlemaps = { module = "dev.jordond.compass:autocomplete-geocoder-googlemaps", version.ref = "compass" }
compass-autocomplete-geocoder-mapbox = { module = "dev.jordond.compass:autocomplete-geocoder-mapbox", version.ref = "compass" }
compass-geocoder = { module = "dev.jordond.compass:geocoder", version.ref = "compass" }
compass-geocoder-mobile = { module = "dev.jordond.compass:geocoder-mobile", version.ref = "compass" }
compass-geocoder-web = { module = "dev.jordond.compass:geocoder-web", version.ref = "compass" }
compass-geocoder-web-googlemaps = { module = "dev.jordond.compass:geocoder-web-googlemaps", version.ref = "compass" }
compass-geocoder-web-mapbox = { module = "dev.jordond.compass:geocoder-web-mapbox", version.ref = "compass" }
compass-geocoder-web-opencage = { module = "dev.jordond.compass:geocoder-web-opencage", version.ref = "compass" }
compass-geolocation = { module = "dev.jordond.compass:geolocation", version.ref = "compass" }
compass-geolocation-mobile = { module = "dev.jordond.compass:geolocation-mobile", version.ref = "compass" }
compass-geolocation-browser = { module = "dev.jordond.compass:geolocation-browser", version.ref = "compass" }
compass-permissions-mobile = { module = "dev.jordond.compass:permissions-mobile", version.ref = "compass" }
  1. Add the dependencies to your build.gradle.kts:

kotlin {
    sourceSets {
        commonMain {
            dependencies {
                // Geocoding
                implementation(libs.compass.geocoder)

                // To use geocoding you need to use one or more of the following

                // Optional - Geocoder support for only iOS and Android
                implementation(libs.compass.geocoder.mobile)

                // Optional - Geocoder support for all platforms, but requires an API key from the service
                implementation(libs.compass.geocoder.web.googlemaps)
                implementation(libs.compass.geocoder.web.mapbox)
                implementation(libs.compass.geocoder.web.opencage)

                // Optional - If you want to create your own geocoder implementation
                implementation(libs.compass.geocoder.web)
                
                // Geolocation
                implementation(libs.compass.geolocation)

                // To use geolocation you need to use one or more of the following
                
                // Optional - Geolocation support for only iOS and Android
                implementation(libs.compass.geolocation.mobile)
                
                // Optional - Geolocation support for JS/WASM Browser Geolocation API
                implementation(libs.compass.geolocation.browser)

                // Autocomplete
                implementation(libs.compass.autocomplete)

                // Optional - Autocomplete support for only iOS and Android using native Geocoder
                implementation(libs.compass.autocomplete.mobile)

                // Optional - Autocomplete support for all platforms, using services Geocoder APIs
                implementation(libs.compass.autocomplete.geocoder.googlemaps)
                implementation(libs.compass.autocomplete.geocoder.mapbox)

                // Optional - If you want to create your own geocoder implementation
                implementation(libs.compass.autocomplete.web)

                // Optional - Location permissions for mobile
                implementation(libs.compass.permissions.mobile)
            }
        }  
    }
}

If you plan on using Compass in a project that targets both mobile and non-mobile platforms (desktop, browser, etc). Then you will need to make sure use expect/actual to provide the implementation for each platform. See Mixed platforms.

Last updated