├── docs
├── images
│ └── cover_image.png
└── INSTALLATION_SETUP.md
├── sample
├── src
│ ├── androidMain
│ │ ├── res
│ │ │ ├── values
│ │ │ │ └── strings.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── swmansion
│ │ │ │ └── kmpsharing
│ │ │ │ └── sample
│ │ │ │ ├── MainActivity.kt
│ │ │ │ └── Utils.android.kt
│ │ └── AndroidManifest.xml
│ ├── iosMain
│ │ └── kotlin
│ │ │ └── com
│ │ │ └── swmansion
│ │ │ └── kmpsharing
│ │ │ └── sample
│ │ │ ├── MainViewController.kt
│ │ │ └── Utils.ios.kt
│ └── commonMain
│ │ ├── kotlin
│ │ └── com
│ │ │ └── swmansion
│ │ │ └── kmpsharing
│ │ │ └── sample
│ │ │ ├── Utils.kt
│ │ │ └── App.kt
│ │ └── composeResources
│ │ └── drawable
│ │ └── compose-multiplatform.xml
├── iosApp
│ ├── iosApp
│ │ ├── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── app-icon-1024.png
│ │ │ │ └── Contents.json
│ │ │ └── AccentColor.colorset
│ │ │ │ └── Contents.json
│ │ ├── Preview Content
│ │ │ └── Preview Assets.xcassets
│ │ │ │ └── Contents.json
│ │ ├── iOSApp.swift
│ │ ├── Info.plist
│ │ └── ContentView.swift
│ ├── Configuration
│ │ └── Config.xcconfig
│ └── iosApp.xcodeproj
│ │ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ │ └── project.pbxproj
└── build.gradle.kts
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── libs.versions.toml
├── kmp-sharing
├── src
│ ├── androidMain
│ │ ├── res
│ │ │ └── xml
│ │ │ │ └── sharing_provider_paths.xml
│ │ ├── AndroidManifest.xml
│ │ └── kotlin
│ │ │ └── com
│ │ │ └── swmansion
│ │ │ └── kmpsharing
│ │ │ └── Sharing.kt
│ ├── commonMain
│ │ └── kotlin
│ │ │ └── com
│ │ │ └── swmansion
│ │ │ └── kmpsharing
│ │ │ ├── SharingUtils.kt
│ │ │ ├── SharingRecords.kt
│ │ │ └── Sharing.kt
│ └── iosMain
│ │ └── kotlin
│ │ └── com
│ │ └── swmansion
│ │ └── kmpsharing
│ │ └── Sharing.kt
└── build.gradle.kts
├── .gitignore
├── .github
└── workflows
│ ├── build.yml
│ ├── check-formatting.yml
│ ├── publish.yml
│ └── depoly.docs.yml
├── gradle.properties
├── settings.gradle.kts
├── LICENSE
├── gradlew.bat
├── README.md
├── .editorconfig
└── gradlew
/docs/images/cover_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/docs/images/cover_image.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Kmpsharing
3 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/software-mansion/kmp-sharing/HEAD/sample/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png
--------------------------------------------------------------------------------
/sample/iosApp/Configuration/Config.xcconfig:
--------------------------------------------------------------------------------
1 | TEAM_ID=
2 |
3 | PRODUCT_NAME=KMP Sharing
4 | PRODUCT_BUNDLE_IDENTIFIER=com.swmansion.kmpsharing.sample$(TEAM_ID)
5 |
6 | CURRENT_PROJECT_VERSION=1
7 | MARKETING_VERSION=1.0
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/iOSApp.swift:
--------------------------------------------------------------------------------
1 | import SwiftUI
2 |
3 | @main
4 | struct iOSApp: App {
5 | var body: some Scene {
6 | WindowGroup {
7 | ContentView()
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/sample/iosApp/iosApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/sample/src/iosMain/kotlin/com/swmansion/kmpsharing/sample/MainViewController.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing.sample
2 |
3 | import androidx.compose.ui.window.ComposeUIViewController
4 |
5 | fun MainViewController() = ComposeUIViewController { App() }
6 |
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CADisableMinimumFrameDurationOnPhone
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/sample/src/commonMain/kotlin/com/swmansion/kmpsharing/sample/Utils.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing.sample
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | const val TEST_IMAGE_WIDTH = 512
6 | const val TEST_IMAGE_HEIGHT = 512
7 |
8 | @Composable expect fun createAndSaveTestBitmap(): String?
9 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/kmp-sharing/src/androidMain/res/xml/sharing_provider_paths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .kotlin
3 | .gradle
4 | **/build/
5 | xcuserdata
6 | !src/**/build/
7 | local.properties
8 | .idea
9 | .DS_Store
10 | captures
11 | .externalNativeBuild
12 | .cxx
13 | *.xcodeproj/*
14 | !*.xcodeproj/project.pbxproj
15 | !*.xcodeproj/xcshareddata/
16 | !*.xcodeproj/project.xcworkspace/
17 | !*.xcworkspace/contents.xcworkspacedata
18 | **/xcshareddata/WorkspaceSettings.xcsettings
19 | node_modules/
20 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 | on:
3 | merge_group:
4 | pull_request:
5 | push:
6 | branches: [main]
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v5
12 | - uses: actions/setup-java@v5
13 | with:
14 | distribution: zulu
15 | java-version: 17
16 | - uses: gradle/actions/setup-gradle@v4
17 | - run: ./gradlew build -x lint -x test
18 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #Kotlin
2 | kotlin.code.style=official
3 | kotlin.daemon.jvmargs=-Xmx3072M
4 |
5 | #Gradle
6 | org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8
7 | org.gradle.configuration-cache=true
8 | org.gradle.caching=true
9 |
10 | #Android
11 | android.nonTransitiveRClass=true
12 | android.useAndroidX=true
13 |
14 | #Dokka
15 | org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
16 | org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
17 |
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/ContentView.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import SwiftUI
3 | import Sample
4 |
5 | struct ComposeView: UIViewControllerRepresentable {
6 | func makeUIViewController(context: Context) -> UIViewController {
7 | MainViewControllerKt.MainViewController()
8 | }
9 |
10 | func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
11 | }
12 |
13 | struct ContentView: View {
14 | var body: some View {
15 | ComposeView()
16 | .ignoresSafeArea()
17 | }
18 | }
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.github/workflows/check-formatting.yml:
--------------------------------------------------------------------------------
1 | name: Check formatting
2 | on:
3 | merge_group:
4 | pull_request:
5 | push:
6 | branches: [main]
7 | jobs:
8 | check-formatting:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v5
12 | - uses: actions/setup-java@v5
13 | with:
14 | distribution: zulu
15 | java-version: 24
16 | - run: |
17 | curl -sSL -o ktfmt.jar https://github.com/facebook/ktfmt/releases/download/v0.58/ktfmt-0.58-with-dependencies.jar
18 | java -jar ktfmt.jar --dry-run --kotlinlang-style --set-exit-if-changed .
19 |
--------------------------------------------------------------------------------
/sample/src/androidMain/kotlin/com/swmansion/kmpsharing/sample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing.sample
2 |
3 | import android.os.Bundle
4 | import androidx.activity.ComponentActivity
5 | import androidx.activity.compose.setContent
6 | import androidx.activity.enableEdgeToEdge
7 | import androidx.compose.runtime.Composable
8 | import androidx.compose.ui.tooling.preview.Preview
9 |
10 | class MainActivity : ComponentActivity() {
11 | override fun onCreate(savedInstanceState: Bundle?) {
12 | enableEdgeToEdge()
13 | super.onCreate(savedInstanceState)
14 |
15 | setContent { App() }
16 | }
17 | }
18 |
19 | @Preview
20 | @Composable
21 | fun AppAndroidPreview() {
22 | App()
23 | }
24 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish
2 | on:
3 | workflow_dispatch:
4 | jobs:
5 | publish:
6 | runs-on: ubuntu-latest
7 | steps:
8 | - uses: actions/checkout@v5
9 | - uses: actions/setup-java@v5
10 | with:
11 | distribution: zulu
12 | java-version: 17
13 | - uses: gradle/actions/setup-gradle@v4
14 | - run: ./gradlew publishToMavenCentral
15 | env:
16 | ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
17 | ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
18 | ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEYS }}
19 | ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEYS_PASSWORD }}
20 |
--------------------------------------------------------------------------------
/docs/INSTALLATION_SETUP.md:
--------------------------------------------------------------------------------
1 | ## 📦 Installation
2 |
3 | ### ✅ Recommended: Using Gradle Version Catalogs
4 |
5 | First, add the library to your `gradle/libs.versions.toml` file:
6 |
7 | ```toml
8 | [versions]
9 | kmpSharing = "0.2.0"
10 |
11 | [libraries]
12 | swmansion-kmpSharing = { module = "com.swmansion.kmpsharing:kmp-sharing", version.ref = "kmpSharing" }
13 | ```
14 |
15 | Then add it to your `build.gradle.kts`:
16 |
17 | ```kotlin
18 | dependencies {
19 | implementation(libs.swmansion.kmpSharing)
20 | }
21 | ```
22 |
23 | ### 🔧 Alternative: Direct Dependency Declaration
24 |
25 | If you're not using Gradle version catalogs, you can add the library directly to your `build.gradle.kts`:
26 |
27 | ```kotlin
28 | dependencies {
29 | implementation("com.swmansion.kmpsharing:kmp-sharing:0.2.0")
30 | }
31 | ```
32 |
--------------------------------------------------------------------------------
/kmp-sharing/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/sample/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "app-icon-1024.png",
5 | "idiom" : "universal",
6 | "platform" : "ios",
7 | "size" : "1024x1024"
8 | },
9 | {
10 | "appearances" : [
11 | {
12 | "appearance" : "luminosity",
13 | "value" : "dark"
14 | }
15 | ],
16 | "idiom" : "universal",
17 | "platform" : "ios",
18 | "size" : "1024x1024"
19 | },
20 | {
21 | "appearances" : [
22 | {
23 | "appearance" : "luminosity",
24 | "value" : "tinted"
25 | }
26 | ],
27 | "idiom" : "universal",
28 | "platform" : "ios",
29 | "size" : "1024x1024"
30 | }
31 | ],
32 | "info" : {
33 | "author" : "xcode",
34 | "version" : 1
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/sample/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | @file:Suppress("UnstableApiUsage")
2 |
3 | rootProject.name = "kmp-sharing"
4 |
5 | pluginManagement {
6 | repositories {
7 | google {
8 | mavenContent {
9 | includeGroupAndSubgroups("androidx")
10 | includeGroupAndSubgroups("com.android")
11 | includeGroupAndSubgroups("com.google")
12 | }
13 | }
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | dependencyResolutionManagement {
20 | repositories {
21 | google {
22 | mavenContent {
23 | includeGroupAndSubgroups("androidx")
24 | includeGroupAndSubgroups("com.android")
25 | includeGroupAndSubgroups("com.google")
26 | }
27 | }
28 | mavenCentral()
29 | }
30 | }
31 |
32 | include(":kmp-sharing", ":sample")
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Software Mansion
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/.github/workflows/depoly.docs.yml:
--------------------------------------------------------------------------------
1 | name: Deploy Documentation
2 |
3 | on:
4 | release:
5 | types: [published]
6 | workflow_dispatch:
7 |
8 | permissions:
9 | contents: read
10 | pages: write
11 | id-token: write
12 |
13 | concurrency:
14 | group: "pages"
15 | cancel-in-progress: false
16 |
17 | jobs:
18 | build-docs:
19 | runs-on: ubuntu-latest
20 | steps:
21 | - name: Checkout
22 | uses: actions/checkout@v5
23 |
24 | - name: Setup Java
25 | uses: actions/setup-java@v5
26 | with:
27 | distribution: zulu
28 | java-version: 17
29 |
30 | - name: Setup Gradle
31 | uses: gradle/actions/setup-gradle@v4
32 |
33 | - name: Generate Dokka documentation
34 | run: ./gradlew :kmp-sharing:dokkaGeneratePublicationHtml
35 |
36 | - name: Setup Pages
37 | uses: actions/configure-pages@v5
38 |
39 | - name: Upload artifact
40 | uses: actions/upload-pages-artifact@v3
41 | with:
42 | path: './kmp-sharing/build/dokka/html'
43 |
44 | deploy:
45 | environment:
46 | name: github-pages
47 | url: ${{ steps.deployment.outputs.page_url }}
48 | runs-on: ubuntu-latest
49 | needs: build-docs
50 | steps:
51 | - name: Deploy to GitHub Pages
52 | id: deployment
53 | uses: actions/deploy-pages@v4
54 |
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.12.0"
3 | android-compileSdk = "36"
4 | android-minSdk = "24"
5 | android-targetSdk = "36"
6 | androidXActivity = "1.11.0"
7 | androidXLifecycle = "2.9.4"
8 | compose = "1.9.0"
9 | coreKtx = "1.17.0"
10 | dokka = "2.1.0"
11 | kotlin = "2.2.20"
12 | mavenPublish = "0.34.0"
13 |
14 | [libraries]
15 | androidX-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidXActivity" }
16 | androidX-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
17 | jetBrains-androidX-lifecycle-runtimeCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidXLifecycle" }
18 | jetBrains-androidX-lifecycle-viewmodelCompose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidXLifecycle" }
19 | jetBrains-kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
20 |
21 | [plugins]
22 | android-application = { id = "com.android.application", version.ref = "agp" }
23 | android-library = { id = "com.android.library", version.ref = "agp" }
24 | jetBrains-compose = { id = "org.jetbrains.compose", version.ref = "compose" }
25 | jetBrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
26 | jetBrains-kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
27 | jetBrains-kotlin-plugin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
28 | vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }
29 |
--------------------------------------------------------------------------------
/kmp-sharing/src/commonMain/kotlin/com/swmansion/kmpsharing/SharingUtils.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing
2 |
3 | /**
4 | * Returns information about the [DataType] for the specified file.
5 | *
6 | * @param content The URL, raw text or path of the file.
7 | */
8 | internal fun getContentType(content: String): DataType {
9 | val trimmed = content.trim()
10 |
11 | return when {
12 | trimmed.startsWith("file://") -> DataType.FILE
13 | trimmed.startsWith("content://") -> DataType.CONTENT
14 | trimmed.startsWith("http://") || trimmed.startsWith("https://") -> DataType.LINK
15 | else -> DataType.TEXT
16 | }
17 | }
18 |
19 | /**
20 | * Validates the sharing constraints for the given files.
21 | *
22 | * @param files The list of files to be shared.
23 | */
24 | internal fun validateSharingConstraints(files: List) {
25 | var urlCount = 0
26 | var textCount = 0
27 |
28 | files.forEach { file ->
29 | when (getContentType(file)) {
30 | DataType.LINK -> urlCount++
31 | DataType.TEXT -> textCount++
32 | DataType.FILE,
33 | DataType.CONTENT -> Unit
34 | }
35 | }
36 |
37 | if (urlCount > 1) {
38 | throw IllegalArgumentException("Only one URL is allowed per share operation")
39 | }
40 |
41 | if (textCount > 1) {
42 | throw IllegalArgumentException("Only one text item is allowed per share operation")
43 | }
44 |
45 | if (urlCount > 0 && textCount > 0) {
46 | throw IllegalArgumentException("URL and text cannot be shared together")
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/sample/src/commonMain/composeResources/drawable/compose-multiplatform.xml:
--------------------------------------------------------------------------------
1 |
8 |
11 |
14 |
16 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
41 |
44 |
--------------------------------------------------------------------------------
/kmp-sharing/src/commonMain/kotlin/com/swmansion/kmpsharing/SharingRecords.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing
2 |
3 | /**
4 | * Platform-specific configuration for Android sharing.
5 | *
6 | * @param dialogTitle Title for Android share dialog
7 | * @param mimeType MIME type override for Android (auto-detected if null)
8 | * @param previewData Preview image path for Android URL and text sharing
9 | */
10 | public data class AndroidSharingOptions(
11 | val dialogTitle: String? = null,
12 | val mimeType: String? = null,
13 | val previewData: String? = null,
14 | )
15 |
16 | /**
17 | * Platform-specific configuration for iOS sharing.
18 | *
19 | * @param anchor Position and size for iOS popover presentation (iPad only)
20 | * @param uti Uniform Type Identifier for file type recognition
21 | */
22 | public data class IosSharingOptions(val anchor: Anchor? = null, val uti: String? = null)
23 |
24 | /**
25 | * Configuration options for sharing behavior across platforms.
26 | *
27 | * @param android Platform-specific options for Android
28 | * @param ios Platform-specific options for iOS
29 | */
30 | public data class SharingOptions(
31 | val android: AndroidSharingOptions? = null,
32 | val ios: IosSharingOptions? = null,
33 | )
34 |
35 | /**
36 | * Represents the position and size for iOS popover presentation.
37 | *
38 | * @param height Height of the anchor rectangle in points
39 | * @param width Width of the anchor rectangle in points
40 | * @param x _x_-coordinate of the anchor rectangle in points
41 | * @param y _y_-coordinate of the anchor rectangle in points
42 | */
43 | public data class Anchor(val height: Float, val width: Float, val x: Float, val y: Float)
44 |
45 | /** Enumeration of supported sharing data types. */
46 | internal enum class DataType {
47 | FILE,
48 | CONTENT,
49 | LINK,
50 | TEXT,
51 | }
52 |
--------------------------------------------------------------------------------
/sample/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/sample/src/iosMain/kotlin/com/swmansion/kmpsharing/sample/Utils.ios.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing.sample
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.runtime.remember
5 | import kotlin.random.Random
6 | import kotlinx.cinterop.ExperimentalForeignApi
7 | import platform.CoreGraphics.*
8 | import platform.Foundation.*
9 | import platform.UIKit.*
10 |
11 | @OptIn(ExperimentalForeignApi::class)
12 | @Composable
13 | actual fun createAndSaveTestBitmap(): String? = remember {
14 | val width = TEST_IMAGE_WIDTH.toDouble()
15 | val height = TEST_IMAGE_HEIGHT.toDouble()
16 | val size = CGSizeMake(width, height)
17 |
18 | UIGraphicsBeginImageContextWithOptions(size, true, 1.0)
19 | val ctx =
20 | UIGraphicsGetCurrentContext()
21 | ?: run {
22 | UIGraphicsEndImageContext()
23 | return@remember null
24 | }
25 |
26 | val bgColor =
27 | UIColor.colorWithRed(Random.nextDouble(), Random.nextDouble(), Random.nextDouble(), 1.0)
28 | CGContextSetFillColorWithColor(ctx, bgColor.CGColor)
29 | CGContextFillRect(ctx, CGRectMake(0.0, 0.0, width, height))
30 |
31 | repeat(5) {
32 | val radius = Random.nextInt(20, 100).toDouble()
33 | val cx = Random.nextDouble(radius, width - radius)
34 | val cy = Random.nextDouble(radius, height - radius)
35 | val circleColor =
36 | UIColor.colorWithRed(Random.nextDouble(), Random.nextDouble(), Random.nextDouble(), 1.0)
37 | CGContextSetFillColorWithColor(ctx, circleColor.CGColor)
38 | val circleRect = CGRectMake(cx - radius, cy - radius, radius * 2, radius * 2)
39 | CGContextFillEllipseInRect(ctx, circleRect)
40 | }
41 |
42 | val image = UIGraphicsGetImageFromCurrentImageContext()
43 | UIGraphicsEndImageContext()
44 | if (image == null) return@remember null
45 |
46 | val data = UIImageJPEGRepresentation(image, 1.0) ?: return@remember null
47 | val filename = "test_image_${NSDate().timeIntervalSince1970}.jpg"
48 | val path = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent(filename)
49 |
50 | return@remember if (data.writeToFile(path, true)) {
51 | "file://$path"
52 | } else {
53 | null
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/sample/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2 |
3 | plugins {
4 | alias(libs.plugins.android.application)
5 | alias(libs.plugins.jetBrains.compose)
6 | alias(libs.plugins.jetBrains.kotlin.multiplatform)
7 | alias(libs.plugins.jetBrains.kotlin.plugin.compose)
8 | }
9 |
10 | kotlin {
11 | androidTarget { compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } }
12 |
13 | listOf(iosArm64(), iosSimulatorArm64()).forEach { iosTarget ->
14 | iosTarget.binaries.framework {
15 | baseName = "Sample"
16 | isStatic = true
17 | binaryOption("bundleId", "com.swmansion.kmpsharing.sample")
18 | }
19 | }
20 |
21 | sourceSets {
22 | androidMain.dependencies {
23 | implementation(compose.preview)
24 | implementation(libs.androidX.activity.compose)
25 | }
26 | commonMain.dependencies {
27 | implementation(compose.components.resources)
28 | implementation(compose.components.uiToolingPreview)
29 | implementation(compose.foundation)
30 | implementation(compose.material3)
31 | implementation(compose.runtime)
32 | implementation(compose.ui)
33 | implementation(libs.jetBrains.androidX.lifecycle.runtimeCompose)
34 | implementation(libs.jetBrains.androidX.lifecycle.viewmodelCompose)
35 | implementation(project(":kmp-sharing"))
36 | }
37 | }
38 | }
39 |
40 | android {
41 | namespace = "com.swmansion.kmpsharing.sample"
42 | compileSdk = libs.versions.android.compileSdk.get().toInt()
43 |
44 | defaultConfig {
45 | applicationId = "com.swmansion.kmpsharing.sample"
46 | minSdk = libs.versions.android.minSdk.get().toInt()
47 | targetSdk = libs.versions.android.targetSdk.get().toInt()
48 | versionCode = 1
49 | versionName = "1.0"
50 | }
51 | packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } }
52 | buildTypes { getByName("release") { isMinifyEnabled = false } }
53 | compileOptions {
54 | sourceCompatibility = JavaVersion.VERSION_11
55 | targetCompatibility = JavaVersion.VERSION_11
56 | }
57 | }
58 |
59 | dependencies { debugImplementation(compose.uiTooling) }
60 |
--------------------------------------------------------------------------------
/kmp-sharing/src/commonMain/kotlin/com/swmansion/kmpsharing/Sharing.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing
2 |
3 | import androidx.compose.runtime.Composable
4 |
5 | /** Interface for sharing files */
6 | public interface Share {
7 | /**
8 | * Share URL, text, or file using the specified options.
9 | *
10 | * @param data URL, text, or file to be shared
11 | * @param options Configuration options for sharing
12 | */
13 | public operator fun invoke(data: String, options: SharingOptions? = null) {
14 | invoke(listOf(data), options)
15 | }
16 |
17 | /**
18 | * Share a list of URL, text, or files using the specified options.
19 | *
20 | * Note: [data] parameter restrictions: maximum one URL OR one text item (not both), but
21 | * multiple files are permitted.
22 | *
23 | * @param data List of URL, text, or files to be shared
24 | * @param options Configuration options for sharing
25 | */
26 | public operator fun invoke(data: List, options: SharingOptions? = null)
27 | }
28 |
29 | /**
30 | * Remember a sharing function that uses the native sharing mechanism of the platform.
31 | *
32 | * This composable function returns a stable callback that opens the platform's native sharing
33 | * interface, allowing users to share the specified file through various apps and services available
34 | * on their device.
35 | *
36 | * ## Basic Usage
37 | *
38 | * ```kotlin
39 | * @Composable
40 | * fun ShareButton() {
41 | * val share = rememberShare()
42 | *
43 | * Button(
44 | * onClick = {
45 | * share(
46 | * url = "file:///path/to/your/file.jpg",
47 | * options = SharingOptions(
48 | * android = AndroidSharingOptions(dialogTitle = "Share Image", mimeType = "image/jpeg"),
49 | * ios = IosSharingOptions(anchor = Anchor(x = 100f, y = 100f, width = 200f, height = 50f))
50 | * )
51 | * )
52 | * }
53 | * ) {
54 | * Text("Share")
55 | * }
56 | * }
57 | * ```
58 | *
59 | * ## File URL Requirements
60 | *
61 | * The returned function supports local file URLs with the `file://` and `content://` scheme:
62 | *
63 | * **Supported:**
64 | * - `file:///storage/emulated/0/Pictures/image.jpg`
65 | * - `content://media/external_primary/images/media/1000002137`
66 | *
67 | * **Not Supported:**
68 | * - `https://example.com/file.jpg` (remote URLs)
69 | * - Relative paths without `file://` scheme
70 | *
71 | * @return A stable [Share] instance that can be invoked to share files
72 | * @throws IllegalArgumentException When the URL is invalid, file doesn't exist, or URL scheme is
73 | * not `file://`
74 | * @throws RuntimeException When the sharing operation fails due to platform-specific errors
75 | */
76 | @Composable public expect fun rememberShare(): Share
77 |
--------------------------------------------------------------------------------
/sample/src/androidMain/kotlin/com/swmansion/kmpsharing/sample/Utils.android.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing.sample
2 |
3 | import android.content.ContentValues
4 | import android.graphics.Bitmap
5 | import android.graphics.Canvas
6 | import android.graphics.Color
7 | import android.graphics.Paint
8 | import android.net.Uri
9 | import android.os.Build
10 | import android.provider.MediaStore
11 | import androidx.compose.runtime.Composable
12 | import androidx.compose.runtime.remember
13 | import androidx.compose.ui.platform.LocalContext
14 | import androidx.core.graphics.createBitmap
15 | import java.io.OutputStream
16 | import kotlin.random.Random
17 |
18 | @Composable
19 | actual fun createAndSaveTestBitmap(): String? {
20 | val context = LocalContext.current
21 |
22 | return remember(context) {
23 | val width = TEST_IMAGE_WIDTH
24 | val height = TEST_IMAGE_HEIGHT
25 | val bitmap = createBitmap(width, height)
26 | val canvas = Canvas(bitmap)
27 | val paint = Paint()
28 |
29 | paint.color = Color.rgb(Random.nextInt(256), Random.nextInt(256), Random.nextInt(256))
30 | canvas.drawRect(0f, 0f, width.toFloat(), height.toFloat(), paint)
31 |
32 | repeat(5) {
33 | paint.color = Color.rgb(Random.nextInt(256), Random.nextInt(256), Random.nextInt(256))
34 | val radius = Random.nextInt(20, 100).toFloat()
35 | val cx = Random.nextInt(radius.toInt(), width - radius.toInt()).toFloat()
36 | val cy = Random.nextInt(radius.toInt(), height - radius.toInt()).toFloat()
37 | canvas.drawCircle(cx, cy, radius, paint)
38 | }
39 |
40 | val displayName = "test_image_${System.currentTimeMillis()}"
41 | val imageCollection: Uri =
42 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
43 | MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY)
44 | } else {
45 | MediaStore.Images.Media.EXTERNAL_CONTENT_URI
46 | }
47 |
48 | val contentValues =
49 | ContentValues().apply {
50 | put(MediaStore.Images.Media.DISPLAY_NAME, "$displayName.jpg")
51 | put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg")
52 | put(MediaStore.Images.Media.WIDTH, bitmap.width)
53 | put(MediaStore.Images.Media.HEIGHT, bitmap.height)
54 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
55 | put(MediaStore.Images.Media.IS_PENDING, 1)
56 | }
57 | }
58 |
59 | val contentResolver = context.contentResolver
60 | val uri: Uri? = contentResolver.insert(imageCollection, contentValues)
61 |
62 | uri?.let {
63 | contentResolver.openOutputStream(it)?.use { outputStream: OutputStream ->
64 | bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream)
65 | }
66 |
67 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
68 | contentValues.clear()
69 | contentValues.put(MediaStore.Images.Media.IS_PENDING, 0)
70 | contentResolver.update(uri, contentValues, null, null)
71 | }
72 | }
73 |
74 | uri?.toString()
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | [](https://kotlinlang.org)
4 | [](./LICENSE)
5 | [](https://central.sonatype.com/artifact/com.swmansion.kmpsharing/kmp-sharing)
6 |
7 | Universal sharing function for Compose Multiplatform.
8 |
9 | ## 🎯 See It in Action
10 |
11 | Check out the sample project in the `/sample` directory for complete usage examples.
12 |
13 |
14 |
15 |
16 |
17 | ## ✨ Features
18 |
19 | - **Cross-platform compatibility** - Single API for both Android and iOS
20 | - **Native performance** - Uses Android `Intent` system and iOS `UIActivityViewController`
21 | - **File sharing support** - Share local files with proper MIME type detection
22 | - **Customizable options** - Platform-specific customization options
23 | - **Compose integration** - Built with Compose Multiplatform for modern UI development
24 |
25 | ## 🚀 Usage
26 |
27 | ```kotlin
28 | @Composable
29 | fun ShareButton() {
30 | val share = rememberShare()
31 |
32 | Button(
33 | onClick = {
34 | share(
35 | data = "file:///path/to/your/file.jpg",
36 | options = SharingOptions(
37 | android = AndroidSharingOptions(
38 | dialogTitle = "Share Image",
39 | mimeType = "image/jpeg"
40 | ),
41 | ios = IosSharingOptions(
42 | anchor = Anchor(x = 100f, y = 100f, width = 200f, height = 50f)
43 | )
44 | )
45 | )
46 | }
47 | ) {
48 | Text("Share")
49 | }
50 | }
51 | ```
52 |
53 | ## 📦 Installation
54 |
55 | For installation instructions visit our [dedicated document](https://github.com/software-mansion/kmp-sharing/blob/main/docs/INSTALLATION_SETUP.md).
56 |
57 | ## 📚 API Reference
58 |
59 | Check out our [dedicated documentation page](https://docs.swmansion.com/kmp-sharing/) for the API reference.
60 |
61 | ## 🤝 Contributing
62 |
63 | We welcome contributions! Please feel free to submit a pull request.
64 |
65 | ## KMP Sharing is created by Software Mansion
66 |
67 | [](https://swmansion.com)
68 |
69 | Since 2012 [Software Mansion](https://swmansion.com) is a software agency with
70 | experience in building web and mobile apps. We are Core React Native
71 | Contributors and experts in dealing with all kinds of React Native issues. We
72 | can help you build your next dream product –
73 | [Hire us](https://swmansion.com/contact/projects?utm_source=typegpu&utm_medium=readme).
74 |
75 | Made by [@software-mansion](https://github.com/software-mansion) and
76 | [community](https://github.com/software-mansion-labs/kmp-sharing/graphs/contributors) 💛
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/kmp-sharing/src/iosMain/kotlin/com/swmansion/kmpsharing/Sharing.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.runtime.remember
5 | import kotlinx.cinterop.*
6 | import platform.CoreGraphics.CGRectMake
7 | import platform.Foundation.*
8 | import platform.UIKit.*
9 |
10 | /** Implementation of [rememberShare] function on iOS */
11 | @Composable
12 | @OptIn(ExperimentalForeignApi::class)
13 | public actual fun rememberShare(): Share = remember {
14 | object : Share {
15 | override fun invoke(data: List, options: SharingOptions?) {
16 | try {
17 | validateSharingConstraints(data)
18 |
19 | val activityItems =
20 | data.map { file ->
21 | when (getContentType(file)) {
22 | DataType.FILE,
23 | DataType.LINK -> {
24 | val nsUrl = NSURL.URLWithString(file)
25 | requireNotNull(nsUrl) { "Invalid URL: $file" }
26 | nsUrl
27 | }
28 | else -> {
29 | file
30 | }
31 | }
32 | }
33 |
34 | val activityViewController =
35 | UIActivityViewController(
36 | activityItems = activityItems,
37 | applicationActivities = null,
38 | )
39 |
40 | val anchor =
41 | options?.ios?.anchor
42 | ?: run {
43 | val screenBounds = UIScreen.mainScreen.bounds
44 | screenBounds.useContents {
45 | val centerX = size.width / 2.0
46 | val centerY = size.height / 2.0
47 | Anchor(
48 | x = centerX.toFloat(),
49 | y = centerY.toFloat(),
50 | width = 200f,
51 | height = 50f,
52 | )
53 | }
54 | }
55 |
56 | activityViewController.popoverPresentationController?.let { popover ->
57 | popover.sourceView = UIApplication.sharedApplication.keyWindow
58 | popover.sourceRect =
59 | CGRectMake(
60 | anchor.x.toDouble(),
61 | anchor.y.toDouble(),
62 | anchor.width.toDouble(),
63 | anchor.height.toDouble(),
64 | )
65 | }
66 |
67 | val rootViewController =
68 | UIApplication.sharedApplication.keyWindow?.rootViewController
69 | requireNotNull(rootViewController) { "Could not find root view controller" }
70 |
71 | rootViewController.presentViewController(
72 | activityViewController,
73 | animated = true,
74 | completion = null,
75 | )
76 | } catch (e: Exception) {
77 | throw RuntimeException("Failed to share: ${e.message}", e)
78 | }
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/kmp-sharing/build.gradle.kts:
--------------------------------------------------------------------------------
1 | group = "com.swmansion.kmpsharing"
2 |
3 | version = "0.2.0"
4 |
5 | plugins {
6 | alias(libs.plugins.android.library)
7 | alias(libs.plugins.jetBrains.compose)
8 | alias(libs.plugins.jetBrains.dokka)
9 | alias(libs.plugins.jetBrains.kotlin.multiplatform)
10 | alias(libs.plugins.jetBrains.kotlin.plugin.compose)
11 | alias(libs.plugins.vanniktech.maven.publish)
12 | }
13 |
14 | kotlin {
15 | explicitApi()
16 | jvmToolchain(17)
17 | androidTarget { publishLibraryVariants("release") }
18 |
19 | compilerOptions { freeCompilerArgs.add("-Xexpect-actual-classes") }
20 |
21 | listOf(iosArm64(), iosSimulatorArm64()).forEach { iosTarget ->
22 | iosTarget.binaries.framework {
23 | baseName = "kmp-sharing"
24 | isStatic = true
25 | }
26 | }
27 |
28 | sourceSets {
29 | commonMain.dependencies {
30 | implementation(compose.components.resources)
31 | implementation(compose.foundation)
32 | implementation(compose.material3)
33 | implementation(compose.runtime)
34 | implementation(compose.ui)
35 | implementation(libs.jetBrains.androidX.lifecycle.runtimeCompose)
36 | implementation(libs.jetBrains.androidX.lifecycle.viewmodelCompose)
37 | }
38 | androidMain.dependencies { implementation(libs.androidX.core.ktx) }
39 | }
40 | }
41 |
42 | android {
43 | namespace = "com.swmansion.kmpsharing"
44 | compileSdk = libs.versions.android.compileSdk.get().toInt()
45 |
46 | defaultConfig { minSdk = libs.versions.android.minSdk.get().toInt() }
47 |
48 | compileOptions {
49 | sourceCompatibility = JavaVersion.VERSION_17
50 | targetCompatibility = JavaVersion.VERSION_17
51 | }
52 | }
53 |
54 | dokka {
55 | moduleName = "KMP Sharing"
56 | pluginsConfiguration.html {
57 | footerMessage =
58 | """
59 | © Software Mansion 2025.
60 | All trademarks and copyrights belong to their respective owners.
61 | """
62 | .trimIndent()
63 | }
64 | }
65 |
66 | mavenPublishing {
67 | publishToMavenCentral()
68 | signAllPublications()
69 | pom {
70 | name = "KMP Sharing"
71 | description = "Universal sharing function for Compose Multiplatform."
72 | url = "https://github.com/software-mansion-labs/kmp-sharing"
73 | licenses {
74 | license {
75 | name = "The MIT License"
76 | url = "http://www.opensource.org/licenses/mit-license.php"
77 | }
78 | }
79 | scm {
80 | connection = "scm:git:git://github.com/software-mansion-labs/kmp-sharing.git"
81 | developerConnection = "scm:git:ssh://github.com/software-mansion-labs/kmp-sharing.git"
82 | url = "https://github.com/software-mansion-labs/kmp-sharing"
83 | }
84 | developers {
85 | developer {
86 | id = "arturgesiarz"
87 | name = "Artur Gęsiarz"
88 | email = "artur.gesiarz@swmansion.com"
89 | }
90 | developer {
91 | id = "marekkaput"
92 | name = "Marek Kaput"
93 | email = "marek.kaput@swmansion.com"
94 | }
95 | developer {
96 | id = "patrickmichalik"
97 | name = "Patrick Michalik"
98 | email = "patrick.michalik@swmansion.com"
99 | }
100 | developer {
101 | id = "justynagreda"
102 | name = "Justyna Gręda"
103 | email = "justyna.greda@swmansion.com"
104 | }
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/sample/src/commonMain/kotlin/com/swmansion/kmpsharing/sample/App.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing.sample
2 |
3 | import androidx.compose.foundation.background
4 | import androidx.compose.foundation.layout.Arrangement
5 | import androidx.compose.foundation.layout.Box
6 | import androidx.compose.foundation.layout.Column
7 | import androidx.compose.foundation.layout.Spacer
8 | import androidx.compose.foundation.layout.fillMaxSize
9 | import androidx.compose.foundation.layout.height
10 | import androidx.compose.foundation.layout.padding
11 | import androidx.compose.foundation.layout.width
12 | import androidx.compose.foundation.shape.RoundedCornerShape
13 | import androidx.compose.material3.Button
14 | import androidx.compose.material3.ButtonDefaults
15 | import androidx.compose.material3.MaterialTheme
16 | import androidx.compose.material3.Text
17 | import androidx.compose.runtime.*
18 | import androidx.compose.ui.Alignment
19 | import androidx.compose.ui.Modifier
20 | import androidx.compose.ui.text.font.FontWeight
21 | import androidx.compose.ui.unit.dp
22 | import com.swmansion.kmpsharing.AndroidSharingOptions
23 | import com.swmansion.kmpsharing.SharingOptions
24 | import com.swmansion.kmpsharing.rememberShare
25 | import org.jetbrains.compose.ui.tooling.preview.Preview
26 |
27 | @Composable
28 | @Preview
29 | fun App() {
30 | val share = rememberShare()
31 | val bitmap = createAndSaveTestBitmap()
32 |
33 | MaterialTheme {
34 | Box(modifier = Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) {
35 | Column(
36 | modifier = Modifier.fillMaxSize().padding(16.dp),
37 | horizontalAlignment = Alignment.CenterHorizontally,
38 | verticalArrangement = Arrangement.Center,
39 | ) {
40 | Button(
41 | onClick = {
42 | share(
43 | data =
44 | "https://blog.swmansion.com/reanimated-4-stable-release-the-future-of-react-native-animations-ba68210c3713",
45 | options =
46 | SharingOptions(
47 | android =
48 | AndroidSharingOptions(
49 | dialogTitle = "Software Mansion Blog",
50 | previewData = bitmap,
51 | )
52 | ),
53 | )
54 | },
55 | modifier = Modifier.height(56.dp).width(200.dp),
56 | colors =
57 | ButtonDefaults.buttonColors(
58 | containerColor = MaterialTheme.colorScheme.primary,
59 | contentColor = MaterialTheme.colorScheme.onPrimary,
60 | ),
61 | shape = RoundedCornerShape(12.dp),
62 | ) {
63 | Text(
64 | text = "Share a link!",
65 | style = MaterialTheme.typography.titleMedium,
66 | fontWeight = FontWeight.Medium,
67 | )
68 | }
69 | Spacer(modifier = Modifier.height(16.dp))
70 | Button(
71 | onClick = { bitmap?.let { share(data = it) } },
72 | enabled = bitmap != null,
73 | modifier = Modifier.height(56.dp).width(200.dp),
74 | colors =
75 | ButtonDefaults.buttonColors(
76 | containerColor = MaterialTheme.colorScheme.primary,
77 | contentColor = MaterialTheme.colorScheme.onPrimary,
78 | ),
79 | shape = RoundedCornerShape(12.dp),
80 | ) {
81 | Text(
82 | text = "Share an image!",
83 | style = MaterialTheme.typography.titleMedium,
84 | fontWeight = FontWeight.Medium,
85 | )
86 | }
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_size = 4
5 | indent_style = space
6 | insert_final_newline = true
7 | max_line_length = 100
8 |
9 | [{*.kt,*.kts}]
10 | ij_continuation_indent_size = 4
11 | ij_java_names_count_to_use_import_on_demand = 9999
12 | ij_kotlin_align_in_columns_case_branch = false
13 | ij_kotlin_align_multiline_binary_operation = false
14 | ij_kotlin_align_multiline_extends_list = false
15 | ij_kotlin_align_multiline_method_parentheses = false
16 | ij_kotlin_align_multiline_parameters = true
17 | ij_kotlin_align_multiline_parameters_in_calls = false
18 | ij_kotlin_allow_trailing_comma = true
19 | ij_kotlin_allow_trailing_comma_on_call_site = true
20 | ij_kotlin_assignment_wrap = normal
21 | ij_kotlin_blank_lines_after_class_header = 0
22 | ij_kotlin_blank_lines_around_block_when_branches = 0
23 | ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
24 | ij_kotlin_block_comment_at_first_column = true
25 | ij_kotlin_call_parameters_new_line_after_left_paren = true
26 | ij_kotlin_call_parameters_right_paren_on_new_line = false
27 | ij_kotlin_call_parameters_wrap = on_every_item
28 | ij_kotlin_catch_on_new_line = false
29 | ij_kotlin_class_annotation_wrap = split_into_lines
30 | ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
31 | ij_kotlin_continuation_indent_for_chained_calls = true
32 | ij_kotlin_continuation_indent_for_expression_bodies = true
33 | ij_kotlin_continuation_indent_in_argument_lists = true
34 | ij_kotlin_continuation_indent_in_elvis = false
35 | ij_kotlin_continuation_indent_in_if_conditions = false
36 | ij_kotlin_continuation_indent_in_parameter_lists = false
37 | ij_kotlin_continuation_indent_in_supertype_lists = false
38 | ij_kotlin_else_on_new_line = false
39 | ij_kotlin_enum_constants_wrap = off
40 | ij_kotlin_extends_list_wrap = normal
41 | ij_kotlin_field_annotation_wrap = off
42 | ij_kotlin_finally_on_new_line = false
43 | ij_kotlin_if_rparen_on_new_line = false
44 | ij_kotlin_import_nested_classes = false
45 | ij_kotlin_imports_layout = *
46 | ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
47 | ij_kotlin_keep_blank_lines_before_right_brace = 2
48 | ij_kotlin_keep_blank_lines_in_code = 2
49 | ij_kotlin_keep_blank_lines_in_declarations = 2
50 | ij_kotlin_keep_first_column_comment = true
51 | ij_kotlin_keep_indents_on_empty_lines = false
52 | ij_kotlin_keep_line_breaks = true
53 | ij_kotlin_lbrace_on_next_line = false
54 | ij_kotlin_line_comment_add_space = false
55 | ij_kotlin_line_comment_at_first_column = true
56 | ij_kotlin_method_annotation_wrap = split_into_lines
57 | ij_kotlin_method_call_chain_wrap = normal
58 | ij_kotlin_method_parameters_new_line_after_left_paren = true
59 | ij_kotlin_method_parameters_right_paren_on_new_line = true
60 | ij_kotlin_method_parameters_wrap = on_every_item
61 | ij_kotlin_name_count_to_use_star_import = 9999
62 | ij_kotlin_name_count_to_use_star_import_for_members = 9999
63 | ij_kotlin_parameter_annotation_wrap = off
64 | ij_kotlin_space_after_comma = true
65 | ij_kotlin_space_after_extend_colon = true
66 | ij_kotlin_space_after_type_colon = true
67 | ij_kotlin_space_before_catch_parentheses = true
68 | ij_kotlin_space_before_comma = false
69 | ij_kotlin_space_before_extend_colon = true
70 | ij_kotlin_space_before_for_parentheses = true
71 | ij_kotlin_space_before_if_parentheses = true
72 | ij_kotlin_space_before_lambda_arrow = true
73 | ij_kotlin_space_before_type_colon = false
74 | ij_kotlin_space_before_when_parentheses = true
75 | ij_kotlin_space_before_while_parentheses = true
76 | ij_kotlin_spaces_around_additive_operators = true
77 | ij_kotlin_spaces_around_assignment_operators = true
78 | ij_kotlin_spaces_around_equality_operators = true
79 | ij_kotlin_spaces_around_function_type_arrow = true
80 | ij_kotlin_spaces_around_logical_operators = true
81 | ij_kotlin_spaces_around_multiplicative_operators = true
82 | ij_kotlin_spaces_around_range = false
83 | ij_kotlin_spaces_around_relational_operators = true
84 | ij_kotlin_spaces_around_unary_operator = false
85 | ij_kotlin_spaces_around_when_arrow = true
86 | ij_kotlin_variable_annotation_wrap = off
87 | ij_kotlin_while_on_new_line = false
88 | ij_kotlin_wrap_elvis_expressions = 1
89 | ij_kotlin_wrap_expression_body_functions = 1
90 | ij_kotlin_wrap_first_method_in_call_chain = false
91 |
92 | [{*.yaml,*.yml,*.json}]
93 | indent_size = 2
94 |
--------------------------------------------------------------------------------
/kmp-sharing/src/androidMain/kotlin/com/swmansion/kmpsharing/Sharing.kt:
--------------------------------------------------------------------------------
1 | package com.swmansion.kmpsharing
2 |
3 | import android.content.ClipData
4 | import android.content.Intent
5 | import android.net.Uri
6 | import androidx.compose.runtime.Composable
7 | import androidx.compose.runtime.remember
8 | import androidx.compose.ui.platform.LocalContext
9 | import androidx.core.content.FileProvider
10 | import androidx.core.net.toUri
11 | import java.io.File
12 |
13 | /** Implementation of [rememberShare] function on Android */
14 | @Composable
15 | public actual fun rememberShare(): Share {
16 | val context = LocalContext.current
17 | return remember {
18 | object : Share {
19 | override fun invoke(data: List, options: SharingOptions?) {
20 | try {
21 | validateSharingConstraints(data)
22 |
23 | val contentUris = mutableListOf()
24 | val textItems = mutableListOf()
25 |
26 | data.forEach { file ->
27 | when (getContentType(file)) {
28 | DataType.FILE -> {
29 | val fileObj = getLocalFileFromUrl(file)
30 | val contentUri =
31 | FileProvider.getUriForFile(
32 | context,
33 | "${context.packageName}.fileprovider",
34 | fileObj,
35 | )
36 | contentUris.add(contentUri)
37 | }
38 | DataType.CONTENT -> {
39 | contentUris.add(file.toUri())
40 | }
41 | DataType.LINK,
42 | DataType.TEXT -> {
43 | textItems.add(file)
44 | }
45 | }
46 | }
47 |
48 | val intent =
49 | Intent(
50 | if (contentUris.size > 1) Intent.ACTION_SEND_MULTIPLE
51 | else Intent.ACTION_SEND
52 | )
53 |
54 | if (contentUris.isNotEmpty()) {
55 | if (contentUris.size == 1) {
56 | intent.putExtra(Intent.EXTRA_STREAM, contentUris[0])
57 | } else {
58 | intent.putParcelableArrayListExtra(
59 | Intent.EXTRA_STREAM,
60 | ArrayList(contentUris),
61 | )
62 | }
63 |
64 | val mimeType = options?.android?.mimeType ?: "image/*"
65 | require(options?.android?.previewData == null) {
66 | "Custom preview data is not supported for sharing images."
67 | }
68 | intent.setTypeAndNormalize(mimeType)
69 | intent.data = contentUris[0]
70 | } else {
71 | intent.setTypeAndNormalize("text/plain")
72 | options?.android?.previewData?.let { previewData ->
73 | val previewUri =
74 | when (getContentType(previewData)) {
75 | DataType.FILE -> {
76 | val fileObj = getLocalFileFromUrl(previewData)
77 | FileProvider.getUriForFile(
78 | context,
79 | "${context.packageName}.fileprovider",
80 | fileObj,
81 | )
82 | }
83 | DataType.CONTENT -> {
84 | previewData.toUri()
85 | }
86 | else ->
87 | throw IllegalArgumentException(
88 | "Unsupported preview data type: $previewData"
89 | )
90 | }
91 | val clipData = ClipData.newRawUri(null, previewUri)
92 | intent.clipData = clipData
93 | }
94 | }
95 |
96 | if (textItems.isNotEmpty()) {
97 | intent.putExtra(Intent.EXTRA_TEXT, textItems.joinToString("\n"))
98 | }
99 |
100 | if (intent.data != null || intent.clipData != null) {
101 | intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
102 | }
103 |
104 | options?.android?.dialogTitle?.let { title ->
105 | intent.putExtra(Intent.EXTRA_TITLE, title)
106 | }
107 |
108 | context.startActivity(
109 | Intent.createChooser(intent, options?.android?.dialogTitle ?: "Share")
110 | .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
111 | )
112 | } catch (e: Exception) {
113 | throw RuntimeException("Failed to share: ${e.message}", e)
114 | }
115 | }
116 | }
117 | }
118 | }
119 |
120 | private fun getLocalFileFromUrl(url: String): File {
121 | val uri = url.toUri()
122 | require(uri.scheme == "file") {
123 | "Only local file URLs are supported (expected scheme to be 'file', got '${uri.scheme}')."
124 | }
125 |
126 | val path = uri.path
127 | requireNotNull(path) { "Path component of the URL to share cannot be null." }
128 |
129 | val file = File(path)
130 | require(file.exists()) { "File does not exist: $path" }
131 |
132 | return file
133 | }
134 |
--------------------------------------------------------------------------------
/sample/src/androidMain/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH="\\\"\\\""
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | if ! command -v java >/dev/null 2>&1
137 | then
138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
139 |
140 | Please set the JAVA_HOME variable in your environment to match the
141 | location of your Java installation."
142 | fi
143 | fi
144 |
145 | # Increase the maximum file descriptors if we can.
146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
147 | case $MAX_FD in #(
148 | max*)
149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
150 | # shellcheck disable=SC2039,SC3045
151 | MAX_FD=$( ulimit -H -n ) ||
152 | warn "Could not query maximum file descriptor limit"
153 | esac
154 | case $MAX_FD in #(
155 | '' | soft) :;; #(
156 | *)
157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
158 | # shellcheck disable=SC2039,SC3045
159 | ulimit -n "$MAX_FD" ||
160 | warn "Could not set maximum file descriptor limit to $MAX_FD"
161 | esac
162 | fi
163 |
164 | # Collect all arguments for the java command, stacking in reverse order:
165 | # * args from the command line
166 | # * the main class name
167 | # * -classpath
168 | # * -D...appname settings
169 | # * --module-path (only if needed)
170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
171 |
172 | # For Cygwin or MSYS, switch paths to Windows format before running java
173 | if "$cygwin" || "$msys" ; then
174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176 |
177 | JAVACMD=$( cygpath --unix "$JAVACMD" )
178 |
179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
180 | for arg do
181 | if
182 | case $arg in #(
183 | -*) false ;; # don't mess with options #(
184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
185 | [ -e "$t" ] ;; #(
186 | *) false ;;
187 | esac
188 | then
189 | arg=$( cygpath --path --ignore --mixed "$arg" )
190 | fi
191 | # Roll the args list around exactly as many times as the number of
192 | # args, so each arg winds up back in the position where it started, but
193 | # possibly modified.
194 | #
195 | # NB: a `for` loop captures its iteration list before it begins, so
196 | # changing the positional parameters here affects neither the number of
197 | # iterations, nor the values presented in `arg`.
198 | shift # remove old arg
199 | set -- "$@" "$arg" # push replacement arg
200 | done
201 | fi
202 |
203 |
204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
206 |
207 | # Collect all arguments for the java command:
208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
209 | # and any embedded shellness will be escaped.
210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
211 | # treated as '${Hostname}' itself on the command line.
212 |
213 | set -- \
214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
215 | -classpath "$CLASSPATH" \
216 | -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217 | "$@"
218 |
219 | # Stop when "xargs" is not available.
220 | if ! command -v xargs >/dev/null 2>&1
221 | then
222 | die "xargs is not available"
223 | fi
224 |
225 | # Use "xargs" to parse quoted args.
226 | #
227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
228 | #
229 | # In Bash we could simply go:
230 | #
231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
232 | # set -- "${ARGS[@]}" "$@"
233 | #
234 | # but POSIX shell has neither arrays nor command substitution, so instead we
235 | # post-process each arg (as a line of input to sed) to backslash-escape any
236 | # character that might be a shell metacharacter, then use eval to reverse
237 | # that process (while maintaining the separation between arguments), and wrap
238 | # the whole thing up as a single "set" statement.
239 | #
240 | # This will of course break if any of these variables contains a newline or
241 | # an unmatched quote.
242 | #
243 |
244 | eval "set -- $(
245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
246 | xargs -n1 |
247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
248 | tr '\n' ' '
249 | )" '"$@"'
250 |
251 | exec "$JAVACMD" "$@"
252 |
--------------------------------------------------------------------------------
/sample/iosApp/iosApp.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 77;
7 | objects = {
8 |
9 | /* Begin PBXFileReference section */
10 | 0C23985189D934E94455EFCD /* KMP Sharing.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "KMP Sharing.app"; sourceTree = BUILT_PRODUCTS_DIR; };
11 | /* End PBXFileReference section */
12 |
13 | /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
14 | 49B070FDBCF78BACC3599D59 /* Exceptions for "iosApp" folder in "iosApp" target */ = {
15 | isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
16 | membershipExceptions = (
17 | Info.plist,
18 | );
19 | target = 40DEA3DD12E93AFB6CA1DD7B /* iosApp */;
20 | };
21 | /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
22 |
23 | /* Begin PBXFileSystemSynchronizedRootGroup section */
24 | 01A05952880C59CB42CED8EC /* Configuration */ = {
25 | isa = PBXFileSystemSynchronizedRootGroup;
26 | path = Configuration;
27 | sourceTree = "";
28 | };
29 | 16130078185ECE616B4B5B4F /* iosApp */ = {
30 | isa = PBXFileSystemSynchronizedRootGroup;
31 | exceptions = (
32 | 49B070FDBCF78BACC3599D59 /* Exceptions for "iosApp" folder in "iosApp" target */,
33 | );
34 | path = iosApp;
35 | sourceTree = "";
36 | };
37 | /* End PBXFileSystemSynchronizedRootGroup section */
38 |
39 | /* Begin PBXFrameworksBuildPhase section */
40 | A29C4D2E19FC7C80DB413AB5 /* Frameworks */ = {
41 | isa = PBXFrameworksBuildPhase;
42 | buildActionMask = 2147483647;
43 | files = (
44 | );
45 | runOnlyForDeploymentPostprocessing = 0;
46 | };
47 | /* End PBXFrameworksBuildPhase section */
48 |
49 | /* Begin PBXGroup section */
50 | C5743CF2632E89A1B8698821 /* Products */ = {
51 | isa = PBXGroup;
52 | children = (
53 | 0C23985189D934E94455EFCD /* KMP Sharing.app */,
54 | );
55 | name = Products;
56 | sourceTree = "";
57 | };
58 | E007095F881EEBD922970F7D = {
59 | isa = PBXGroup;
60 | children = (
61 | 01A05952880C59CB42CED8EC /* Configuration */,
62 | 16130078185ECE616B4B5B4F /* iosApp */,
63 | C5743CF2632E89A1B8698821 /* Products */,
64 | );
65 | sourceTree = "";
66 | };
67 | /* End PBXGroup section */
68 |
69 | /* Begin PBXNativeTarget section */
70 | 40DEA3DD12E93AFB6CA1DD7B /* iosApp */ = {
71 | isa = PBXNativeTarget;
72 | buildConfigurationList = 7F223E914FECC974221763A9 /* Build configuration list for PBXNativeTarget "iosApp" */;
73 | buildPhases = (
74 | D0286FF3A69EF3029031D41B /* Compile Kotlin Framework */,
75 | AAEEF215302C9CE718FC8EB9 /* Sources */,
76 | A29C4D2E19FC7C80DB413AB5 /* Frameworks */,
77 | 7744A72548E1C81CA3A33212 /* Resources */,
78 | );
79 | buildRules = (
80 | );
81 | dependencies = (
82 | );
83 | fileSystemSynchronizedGroups = (
84 | 16130078185ECE616B4B5B4F /* iosApp */,
85 | );
86 | name = iosApp;
87 | packageProductDependencies = (
88 | );
89 | productName = iosApp;
90 | productReference = 0C23985189D934E94455EFCD /* KMP Sharing.app */;
91 | productType = "com.apple.product-type.application";
92 | };
93 | /* End PBXNativeTarget section */
94 |
95 | /* Begin PBXProject section */
96 | 79D7324E63FABE0783299880 /* Project object */ = {
97 | isa = PBXProject;
98 | attributes = {
99 | BuildIndependentTargetsInParallel = 1;
100 | LastSwiftUpdateCheck = 1620;
101 | LastUpgradeCheck = 1620;
102 | TargetAttributes = {
103 | 40DEA3DD12E93AFB6CA1DD7B = {
104 | CreatedOnToolsVersion = 16.2;
105 | };
106 | };
107 | };
108 | buildConfigurationList = C3C29CCA02428E27D2084EFF /* Build configuration list for PBXProject "iosApp" */;
109 | developmentRegion = en;
110 | hasScannedForEncodings = 0;
111 | knownRegions = (
112 | en,
113 | Base,
114 | );
115 | mainGroup = E007095F881EEBD922970F7D;
116 | minimizedProjectReferenceProxies = 1;
117 | preferredProjectObjectVersion = 77;
118 | productRefGroup = C5743CF2632E89A1B8698821 /* Products */;
119 | projectDirPath = "";
120 | projectRoot = "";
121 | targets = (
122 | 40DEA3DD12E93AFB6CA1DD7B /* iosApp */,
123 | );
124 | };
125 | /* End PBXProject section */
126 |
127 | /* Begin PBXResourcesBuildPhase section */
128 | 7744A72548E1C81CA3A33212 /* Resources */ = {
129 | isa = PBXResourcesBuildPhase;
130 | buildActionMask = 2147483647;
131 | files = (
132 | );
133 | runOnlyForDeploymentPostprocessing = 0;
134 | };
135 | /* End PBXResourcesBuildPhase section */
136 |
137 | /* Begin PBXShellScriptBuildPhase section */
138 | D0286FF3A69EF3029031D41B /* Compile Kotlin Framework */ = {
139 | isa = PBXShellScriptBuildPhase;
140 | alwaysOutOfDate = 1;
141 | buildActionMask = 2147483647;
142 | files = (
143 | );
144 | inputFileListPaths = (
145 | );
146 | inputPaths = (
147 | );
148 | name = "Compile Kotlin Framework";
149 | outputFileListPaths = (
150 | );
151 | outputPaths = (
152 | );
153 | runOnlyForDeploymentPostprocessing = 0;
154 | shellPath = /bin/sh;
155 | shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :sample:embedAndSignAppleFrameworkForXcode\n";
156 | };
157 | /* End PBXShellScriptBuildPhase section */
158 |
159 | /* Begin PBXSourcesBuildPhase section */
160 | AAEEF215302C9CE718FC8EB9 /* Sources */ = {
161 | isa = PBXSourcesBuildPhase;
162 | buildActionMask = 2147483647;
163 | files = (
164 | );
165 | runOnlyForDeploymentPostprocessing = 0;
166 | };
167 | /* End PBXSourcesBuildPhase section */
168 |
169 | /* Begin XCBuildConfiguration section */
170 | 52EA1C242CF0592DAFB749B7 /* Debug */ = {
171 | isa = XCBuildConfiguration;
172 | baseConfigurationReferenceAnchor = 01A05952880C59CB42CED8EC /* Configuration */;
173 | baseConfigurationReferenceRelativePath = Config.xcconfig;
174 | buildSettings = {
175 | ALWAYS_SEARCH_USER_PATHS = NO;
176 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
177 | CLANG_ANALYZER_NONNULL = YES;
178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
180 | CLANG_ENABLE_MODULES = YES;
181 | CLANG_ENABLE_OBJC_ARC = YES;
182 | CLANG_ENABLE_OBJC_WEAK = YES;
183 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
184 | CLANG_WARN_BOOL_CONVERSION = YES;
185 | CLANG_WARN_COMMA = YES;
186 | CLANG_WARN_CONSTANT_CONVERSION = YES;
187 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
188 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
189 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
190 | CLANG_WARN_EMPTY_BODY = YES;
191 | CLANG_WARN_ENUM_CONVERSION = YES;
192 | CLANG_WARN_INFINITE_RECURSION = YES;
193 | CLANG_WARN_INT_CONVERSION = YES;
194 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
195 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
196 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
197 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
198 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
200 | CLANG_WARN_STRICT_PROTOTYPES = YES;
201 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
203 | CLANG_WARN_UNREACHABLE_CODE = YES;
204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
205 | COPY_PHASE_STRIP = NO;
206 | DEBUG_INFORMATION_FORMAT = dwarf;
207 | ENABLE_STRICT_OBJC_MSGSEND = YES;
208 | ENABLE_TESTABILITY = YES;
209 | ENABLE_USER_SCRIPT_SANDBOXING = NO;
210 | GCC_C_LANGUAGE_STANDARD = gnu17;
211 | GCC_DYNAMIC_NO_PIC = NO;
212 | GCC_NO_COMMON_BLOCKS = YES;
213 | GCC_OPTIMIZATION_LEVEL = 0;
214 | GCC_PREPROCESSOR_DEFINITIONS = (
215 | "DEBUG=1",
216 | "$(inherited)",
217 | );
218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
220 | GCC_WARN_UNDECLARED_SELECTOR = YES;
221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
222 | GCC_WARN_UNUSED_FUNCTION = YES;
223 | GCC_WARN_UNUSED_VARIABLE = YES;
224 | IPHONEOS_DEPLOYMENT_TARGET = 18.2;
225 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
226 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
227 | MTL_FAST_MATH = YES;
228 | ONLY_ACTIVE_ARCH = YES;
229 | SDKROOT = iphoneos;
230 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
231 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
232 | };
233 | name = Debug;
234 | };
235 | 58C0D47F34615B487E8DFE1D /* Release */ = {
236 | isa = XCBuildConfiguration;
237 | buildSettings = {
238 | ARCHS = arm64;
239 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
240 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
241 | CODE_SIGN_IDENTITY = "Apple Development";
242 | CODE_SIGN_STYLE = Automatic;
243 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
244 | DEVELOPMENT_TEAM = "${TEAM_ID}";
245 | ENABLE_PREVIEWS = YES;
246 | GENERATE_INFOPLIST_FILE = YES;
247 | INFOPLIST_FILE = iosApp/Info.plist;
248 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
249 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
250 | INFOPLIST_KEY_UILaunchScreen_Generation = YES;
251 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
252 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
253 | LD_RUNPATH_SEARCH_PATHS = (
254 | "$(inherited)",
255 | "@executable_path/Frameworks",
256 | );
257 | SWIFT_EMIT_LOC_STRINGS = YES;
258 | SWIFT_VERSION = 5.0;
259 | TARGETED_DEVICE_FAMILY = "1,2";
260 | };
261 | name = Release;
262 | };
263 | 6BD29FD386E7D7700352E2D4 /* Release */ = {
264 | isa = XCBuildConfiguration;
265 | baseConfigurationReferenceAnchor = 01A05952880C59CB42CED8EC /* Configuration */;
266 | baseConfigurationReferenceRelativePath = Config.xcconfig;
267 | buildSettings = {
268 | ALWAYS_SEARCH_USER_PATHS = NO;
269 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
270 | CLANG_ANALYZER_NONNULL = YES;
271 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
272 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
273 | CLANG_ENABLE_MODULES = YES;
274 | CLANG_ENABLE_OBJC_ARC = YES;
275 | CLANG_ENABLE_OBJC_WEAK = YES;
276 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
277 | CLANG_WARN_BOOL_CONVERSION = YES;
278 | CLANG_WARN_COMMA = YES;
279 | CLANG_WARN_CONSTANT_CONVERSION = YES;
280 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
281 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
282 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
283 | CLANG_WARN_EMPTY_BODY = YES;
284 | CLANG_WARN_ENUM_CONVERSION = YES;
285 | CLANG_WARN_INFINITE_RECURSION = YES;
286 | CLANG_WARN_INT_CONVERSION = YES;
287 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
288 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
289 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
290 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
291 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
292 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
293 | CLANG_WARN_STRICT_PROTOTYPES = YES;
294 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
295 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
296 | CLANG_WARN_UNREACHABLE_CODE = YES;
297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
298 | COPY_PHASE_STRIP = NO;
299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
300 | ENABLE_NS_ASSERTIONS = NO;
301 | ENABLE_STRICT_OBJC_MSGSEND = YES;
302 | ENABLE_USER_SCRIPT_SANDBOXING = NO;
303 | GCC_C_LANGUAGE_STANDARD = gnu17;
304 | GCC_NO_COMMON_BLOCKS = YES;
305 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
306 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
307 | GCC_WARN_UNDECLARED_SELECTOR = YES;
308 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
309 | GCC_WARN_UNUSED_FUNCTION = YES;
310 | GCC_WARN_UNUSED_VARIABLE = YES;
311 | IPHONEOS_DEPLOYMENT_TARGET = 18.2;
312 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
313 | MTL_ENABLE_DEBUG_INFO = NO;
314 | MTL_FAST_MATH = YES;
315 | SDKROOT = iphoneos;
316 | SWIFT_COMPILATION_MODE = wholemodule;
317 | VALIDATE_PRODUCT = YES;
318 | };
319 | name = Release;
320 | };
321 | C8C5F93B1F23D2183AF5F397 /* Debug */ = {
322 | isa = XCBuildConfiguration;
323 | buildSettings = {
324 | ARCHS = arm64;
325 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
326 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
327 | CODE_SIGN_IDENTITY = "Apple Development";
328 | CODE_SIGN_STYLE = Automatic;
329 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
330 | DEVELOPMENT_TEAM = "${TEAM_ID}";
331 | ENABLE_PREVIEWS = YES;
332 | GENERATE_INFOPLIST_FILE = YES;
333 | INFOPLIST_FILE = iosApp/Info.plist;
334 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
335 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
336 | INFOPLIST_KEY_UILaunchScreen_Generation = YES;
337 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
338 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
339 | LD_RUNPATH_SEARCH_PATHS = (
340 | "$(inherited)",
341 | "@executable_path/Frameworks",
342 | );
343 | SWIFT_EMIT_LOC_STRINGS = YES;
344 | SWIFT_VERSION = 5.0;
345 | TARGETED_DEVICE_FAMILY = "1,2";
346 | };
347 | name = Debug;
348 | };
349 | /* End XCBuildConfiguration section */
350 |
351 | /* Begin XCConfigurationList section */
352 | 7F223E914FECC974221763A9 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
353 | isa = XCConfigurationList;
354 | buildConfigurations = (
355 | C8C5F93B1F23D2183AF5F397 /* Debug */,
356 | 58C0D47F34615B487E8DFE1D /* Release */,
357 | );
358 | defaultConfigurationIsVisible = 0;
359 | defaultConfigurationName = Release;
360 | };
361 | C3C29CCA02428E27D2084EFF /* Build configuration list for PBXProject "iosApp" */ = {
362 | isa = XCConfigurationList;
363 | buildConfigurations = (
364 | 52EA1C242CF0592DAFB749B7 /* Debug */,
365 | 6BD29FD386E7D7700352E2D4 /* Release */,
366 | );
367 | defaultConfigurationIsVisible = 0;
368 | defaultConfigurationName = Release;
369 | };
370 | /* End XCConfigurationList section */
371 | };
372 | rootObject = 79D7324E63FABE0783299880 /* Project object */;
373 | }
374 |
--------------------------------------------------------------------------------