diff --git a/README.md b/README.md index 40943e6..1858dc7 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,30 @@ -# Kotlin Multiplatform Result Class +
+ +![KmmResult](kmmresult.png) + + +# Swift-Friendly Kotlin Multiplatform Result Class + [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-brightgreen.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) ![Build KMP](https://github.com/a-sit-plus/kmmresult/actions/workflows/build-jvm.yml/badge.svg) ![Build iOS](https://github.com/a-sit-plus/kmmresult/actions/workflows/build-ios.yml/badge.svg) +[![A-SIT Plus Official](https://img.shields.io/badge/A--SIT_Plus-official-005b79?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNDMuNzYyODYgMTg0LjgxOTk5Ij48ZGVmcz48Y2xpcFBhdGggaWQ9ImEiIGNsaXBQYXRoVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48cGF0aCBkPSJNMCA1OTUuMjhoODQxLjg5VjBIMFoiLz48L2NsaXBQYXRoPjwvZGVmcz48ZyBjbGlwLXBhdGg9InVybCgjYSkiIHRyYW5zZm9ybT0ibWF0cml4KDEuMzMzMzMzMyAwIDAgLTEuMzMzMzMzMyAtNDgyLjI1IDUxNy41MykiPjxwYXRoIGZpbGw9IiMwMDViNzkiIGQ9Ik00MTUuNjcgMjQ5LjUzYy03LjE1LjA4LTEzLjk0IDEtMjAuMTcgMi43NWE1Mi4zMyA1Mi4zMyAwIDAgMC0xNy40OCA4LjQ2IDQwLjQzIDQwLjQzIDAgMCAwLTExLjk2IDE0LjU2Yy0yLjY4IDUuNDEtNC4xNCAxMS44NC00LjM1IDE5LjA5bC0uMDIgNi4xMnYyLjE3YS43MS43MSAwIDAgMCAuNy43M2gxNi41MmMuMzkgMCAuNy0uMzIuNzEtLjdsLjAxLTIuMmMwLTIuNi4wMi01LjgyLjAz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MDktMTIuMmwtLjAxLTcuNDdoODkuMTZhLjcuNyAwIDAgMCAuNy0uNzJ2LTM5LjVjLS4xLTcuNjUtMS41OC0xNC40LTQuMzgtMjAuMDZhNDAuNCA0MC40IDAgMCAwLTExLjk1LTE0LjU2IDUyLjM3IDUyLjM3IDAgMCAwLTE3LjQ4LTguNDcgNzcuNTYgNzcuNTYgMCAwIDAtMjAuMDEtMi43N1oiLz48cGF0aCBmaWxsPSIjY2U0OTJlIiBkPSJNNDE5LjM4IDI4MC42M2gtNy41N2EuNy43IDAgMCAwLS43MS43MXYxNS40MmE4LjE3IDguMTcgMCAwIDAtMy43OCA2LjkgOC4yOCA4LjI4IDAgMCAwIDE2LjU0IDAgOC4yOSA4LjI5IDAgMCAwLTMuNzYtNi45di0xNS40MmEuNy43IDAgMCAwLS43Mi0uNzEiLz48L2c%2BPC9zdmc%2B&logoColor=white&labelColor=white)](https://a-sit-plus.github.io) [![Kotlin](https://img.shields.io/badge/kotlin-multiplatform--mobile-orange.svg?logo=kotlin)](http://kotlinlang.org) [![Kotlin](https://img.shields.io/badge/kotlin-2.0.0-blue.svg?logo=kotlin)](http://kotlinlang.org) ![Java](https://img.shields.io/badge/java-17-blue.svg?logo=OPENJDK) [![Maven Central](https://img.shields.io/maven-central/v/at.asitplus/kmmresult)](https://mvnrepository.com/artifact/at.asitplus/kmmresult/) + +
+ + + Wrapper for `kotlin.Result` with KMM goodness, s.t. it becomes possible to expose a result class to public APIs interfacing with platform-specific code. For Kotlin/Native (read: iOS), this requires a `Result` equivalent, which is *not* a value class (a sealed `Either` type also does not interop well with Swift). -`KmmResult` comes to the rescue! →[Full documentation](https://a-sit-plus.github.io/KmmResult/). +`KmmResult` comes to the rescue! → [Full documentation](https://a-sit-plus.github.io/KmmResult/). ## Using in your Projects @@ -72,3 +84,12 @@ func funWithKotlin() -> KmmResult { ``` Happy folding! + +
+ +--- + +

+The Apache License does not apply to the logos, (including the A-SIT logo) and the project/module name(s), as these are the sole property of +A-SIT/A-SIT Plus GmbH and may not be used in derivative works without explicit permission! +

diff --git a/build.gradle.kts b/build.gradle.kts index d879e3d..4486921 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ import io.gitlab.arturbosch.detekt.Detekt import org.gradle.kotlin.dsl.support.listFilesOrdered +import org.jetbrains.kotlin.build.joinToReadableString plugins { kotlin("multiplatform") version "2.0.0" @@ -24,9 +25,9 @@ tasks.dokkaHtml { val moduleDesc = File("$rootDir/dokka-tmp.md").also { it.createNewFile() } val readme = - File("${rootDir}/README.md").readText().replaceFirst("# ", "") - val moduleTitle = readme.lines().first() - moduleDesc.writeText("# Module $readme") + File("${rootDir}/README.md").readText() + val moduleTitle = project.name + moduleDesc.writeText("# Module ${project.name}\n\n$readme") moduleName.set(moduleTitle) dokkaSourceSets { diff --git a/kmmresult.png b/kmmresult.png new file mode 100644 index 0000000..e46eabd Binary files /dev/null and b/kmmresult.png differ