Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/telereso/kmp-annotations
Core annotations for developing kmp projects
https://github.com/telereso/kmp-annotations
kotlin kotlin-multiplatform kotlin-multiplatform-library
Last synced: 2 months ago
JSON representation
Core annotations for developing kmp projects
- Host: GitHub
- URL: https://github.com/telereso/kmp-annotations
- Owner: telereso
- License: mit
- Created: 2023-01-13T03:02:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-15T01:24:26.000Z (4 months ago)
- Last Synced: 2024-09-15T07:31:36.507Z (4 months ago)
- Topics: kotlin, kotlin-multiplatform, kotlin-multiplatform-library
- Language: Kotlin
- Homepage:
- Size: 1.51 MB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# KMP Annotations
![kotlin: 2.0.20](https://img.shields.io/badge/kotlin-2.0.20-blue?logo=kotlin)A kotlin multiplatform (kmp) annotations to auto generate code to support and speed up building KMP SDKs,
The project also support a [gradle plugin](https://plugins.gradle.org/plugin/io.telereso.kmp) that has helpful tasks to can setup the integration faster
## Requirements
* kmp project structure , you can start your [kmp project here](https://kmp-starter.telereso.io) ,
the annotations and gradle plugin are compatible with this structure but you can try using them in your own structure## Annotations
### [@Serializable](https://kmp.telereso.io/annotations/Serializable.html)
This is the same [official annotation in kotlin](https://kotlinlang.org/docs/serialization.html)
However the gradle plugin [io.telereso.kmp](https://plugins.gradle.org/plugin/io.telereso.kmp) will add json conversion extension functions
Example
```kotlin
@Serializable
data class Data(val a: Int, val b: String)
```
After adding the plugin you will get `fromJson`, `fromJsonArray` , `toJson` , and to `toPrettyJson` functions```kotlin
val data = Data.fromJson("{\"a\": 1,\"b\": \"test\"}")
val json = data.toJson() // minified json
val json = data.toPrettyJson() // human readable json// Also support json array
val jsonArray = Data.fromJsonArray("[{\"a\":1,\"b\":\"test\"},{\"a\":1,\"b\":\"test\"}]")
```
### [@ReactNativeExport](https://kmp.telereso.io/annotations/ReactNativeExport.html) (alpha)
An "interop" from kotlin to react native plugins , basically it convert a kmp sdk manager class into a ReactNative plugin manger interface.### [@Builder](https://kmp.telereso.io/annotations/Builder.html)
### [@SwiftOverloads](https://kmp.telereso.io/annotations/SwiftOverloads.html)
### [@ListWrapper](https://kmp.telereso.io/annotations/ListWrapper.html)
### [@FlutterExport](https://kmp.telereso.io/annotations/FlutterExport.html) (WIP)
An "interop" from kotlin to flutter plugins , basically it convert a kmp sdk manager class into a Flutter plugin manger interface.