Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/05nelsonm/component-parcelize
Kotlin Multiplatform support for using android.os.Parcelable from common code
https://github.com/05nelsonm/component-parcelize
android android-lib android-library android-libs kotlin kotlin-android kotlin-library kotlin-multiplatform kotlin-multiplatform-library kotlin-multiplatform-mobile
Last synced: 3 months ago
JSON representation
Kotlin Multiplatform support for using android.os.Parcelable from common code
- Host: GitHub
- URL: https://github.com/05nelsonm/component-parcelize
- Owner: 05nelsonm
- License: apache-2.0
- Created: 2022-07-19T10:35:26.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-17T11:10:35.000Z (almost 2 years ago)
- Last Synced: 2024-10-01T17:05:38.849Z (4 months ago)
- Topics: android, android-lib, android-library, android-libs, kotlin, kotlin-android, kotlin-library, kotlin-multiplatform, kotlin-multiplatform-library, kotlin-multiplatform-mobile
- Language: Kotlin
- Homepage: https://kotlin-components.matthewnelson.io
- Size: 188 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin-multiplatform - parcelize - Implement Android `Parcelable` from common code. (Libraries / Serializer)
README
# component-parcelize
[![badge-license]][url-license]
[![badge-latest-release]][url-latest-release][![badge-kotlin]][url-kotlin]
![badge-platform-android]
![badge-platform-jvm]
![badge-platform-js]
![badge-platform-js-node]
![badge-platform-linux]
![badge-platform-macos]
![badge-platform-ios]
![badge-platform-tvos]
![badge-platform-watchos]
![badge-platform-wasm]
![badge-platform-windows]
![badge-support-android-native]
![badge-support-apple-silicon]
![badge-support-js-ir]
![badge-support-linux-arm]
![badge-support-linux-mips]Kotlin Multiplatform support for using `android.os.Parcelable` from common code.
A full list of `kotlin-components` projects can be found [HERE](https://kotlin-components.matthewnelson.io)
### Get Started
- Add dependency to `commonMain`
```kotlin
// build.gradle.kts
dependencies {
val vParcelize = "0.1.2"
// If usage is a part of your public api, use `api`; otherwise
// use `implementation` for internal-only usage.
api("io.matthewnelson.kotlin-components:parcelize:$vParcelize")
}
``````groovy
// build.gradle
dependencies {
def vParcelize = "0.1.1"
// If usage is a part of your public api, use `api`; otherwise
// use `implementation` for internal-only usage.
api "io.matthewnelson.kotlin-components:parcelize:$vParcelize"
}
```- Add the `kotlin-parcelize` plugin to your project
```kotlin
plugins {
id("kotlin-parcelize")
}
```### Usage
- In `commonMain`
```kotlin
import io.matthewnelson.component.parcelize.Parcelable
import io.matthewnelson.component.parcelize.Parcelize@Parcelize
data class MyData(val value: String): Parcelable
```
- Usable from `androidMain`
```kotlin
// androidMain
val intent = Intent()
intent.putExtra("MY_DATA", MyData("Parcelable commonMain class"))
val myData = intent.getParcelableExtra("MY_DATA")
println(myData.toString())
```- See the [sample-data][url-sample-data] and [sample-app][url-sample-app] examples
### Kotlin Version Compatibility
| parcelize | kotlin |
|:---------:|:------:|
| 0.1.2 | 1.8.0 |
| 0.1.1 | 1.7.20 |
| 0.1.0 | 1.6.21 |### Git
This project utilizes git submodules. You will need to initialize them when
cloning the repository via:```bash
$ git clone --recursive https://github.com/05nelsonm/component-parcelize.git
```If you've already cloned the repository, run:
```bash
$ git checkout master
$ git pull
$ git submodule update --init
```In order to keep submodules updated when pulling the latest code, run:
```bash
$ git pull --recurse-submodules
```[badge-latest-release]: https://img.shields.io/badge/latest--release-0.1.2-blue.svg?style=flat
[badge-license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat[badge-kotlin]: https://img.shields.io/badge/kotlin-1.8.0-blue.svg?logo=kotlin
[badge-platform-android]: http://img.shields.io/badge/-android-6EDB8D.svg?style=flat
[badge-platform-jvm]: http://img.shields.io/badge/-jvm-DB413D.svg?style=flat
[badge-platform-js]: http://img.shields.io/badge/-js-F8DB5D.svg?style=flat
[badge-platform-js-node]: https://img.shields.io/badge/-nodejs-68a063.svg?style=flat
[badge-platform-linux]: http://img.shields.io/badge/-linux-2D3F6C.svg?style=flat
[badge-platform-macos]: http://img.shields.io/badge/-macos-111111.svg?style=flat
[badge-platform-ios]: http://img.shields.io/badge/-ios-CDCDCD.svg?style=flat
[badge-platform-tvos]: http://img.shields.io/badge/-tvos-808080.svg?style=flat
[badge-platform-watchos]: http://img.shields.io/badge/-watchos-C0C0C0.svg?style=flat
[badge-platform-wasm]: https://img.shields.io/badge/-wasm-624FE8.svg?style=flat
[badge-platform-windows]: http://img.shields.io/badge/-windows-4D76CD.svg?style=flat
[badge-support-android-native]: http://img.shields.io/badge/support-[AndroidNative]-6EDB8D.svg?style=flat
[badge-support-apple-silicon]: http://img.shields.io/badge/support-[AppleSilicon]-43BBFF.svg?style=flat
[badge-support-js-ir]: https://img.shields.io/badge/support-[js--IR]-AAC4E0.svg?style=flat
[badge-support-linux-arm]: http://img.shields.io/badge/support-[LinuxArm]-2D3F6C.svg?style=flat
[badge-support-linux-mips]: http://img.shields.io/badge/support-[LinuxMIPS]-2D3F6C.svg?style=flat[url-latest-release]: https://github.com/05nelsonm/component-parcelize/releases/latest
[url-license]: https://www.apache.org/licenses/LICENSE-2.0.txt
[url-kotlin]: https://kotlinlang.org
[url-sample-app]: https://github.com/05nelsonm/component-parcelize/tree/master/sample/app
[url-sample-data]: https://github.com/05nelsonm/component-parcelize/tree/master/sample/sample-data