{"id":13536833,"url":"https://github.com/florent37/Multiplatform-LiveData","last_synced_at":"2025-04-02T03:31:12.742Z","repository":{"id":91120190,"uuid":"156707146","full_name":"florent37/Multiplatform-LiveData","owner":"florent37","description":"Multiplatorm implementation of LiveDatas / MVVM in kotlin android \u0026 native ios","archived":true,"fork":false,"pushed_at":"2020-05-23T10:15:26.000Z","size":144,"stargazers_count":94,"open_issues_count":3,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-03T01:33:24.438Z","etag":null,"topics":["android","architecture","components","ios","kotlin","livedata","multiplatform","mvvm","native","observable","swift"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/florent37.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-11-08T12:56:26.000Z","updated_at":"2023-01-28T03:18:53.000Z","dependencies_parsed_at":"2024-01-16T15:50:31.642Z","dependency_job_id":null,"html_url":"https://github.com/florent37/Multiplatform-LiveData","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FMultiplatform-LiveData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FMultiplatform-LiveData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FMultiplatform-LiveData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FMultiplatform-LiveData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florent37","download_url":"https://codeload.github.com/florent37/Multiplatform-LiveData/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246751087,"owners_count":20827833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","architecture","components","ios","kotlin","livedata","multiplatform","mvvm","native","observable","swift"],"created_at":"2024-08-01T09:00:50.212Z","updated_at":"2025-04-02T03:31:11.960Z","avatar_url":"https://github.com/florent37.png","language":"Kotlin","funding_links":[],"categories":["Libraries","Kotlin"],"sub_categories":["Reactive"],"readme":"# Multiplatform LiveData\n\nRéimplémentation of android LiveDatas on kotlin-multiplatform\n\nIt wraps reals livedatas on Android, and uses an Observable-Pattern on iOS\n\nIt works exactly the same as Android LiveDatas : https://developer.android.com/topic/libraries/architecture/livedata\n\n`KLiveData\u003cT\u003e` Read only observable\n`KMutableLiveData\u003cT\u003e` Read / Write observable\n`KMediatorLiveData\u003cT\u003e` Read / Write observable, capable of listen `KLiveData`\n\nTransformations like `map` and `switchmap` are available too\n\n```kotlin\nclass MainViewModel(val premiumManager: PremiumManager) {\n    private val _viewState = KMediatorLiveData\u003cViewState\u003e()\n    \n    val viewState = KLiveData\u003cViewState\u003e()\n        get() = _viewState\n\n    init {\n        _viewState.value = ViewState(\"not premium\")\n\n        _viewState.addSource(premiumManager.premium()) {\n            if(it) {\n                _viewState.value = ViewState(\"premium\")\n            } else {\n                _viewState.value = ViewState(\"not premium\")\n            }\n        }\n    }\n}\n```\n\n```kotlin\nclass ViewState(\n    val userStatus: String\n)\n```\n\n```kotlin\nclass PremiumManager {\n    private val premium = KMutableLiveData\u003cBoolean\u003e()\n    fun premium() : KLiveData\u003cBoolean\u003e {\n        return premium\n    }\n\n    fun becomePremium() {\n        premium.value = true\n    }\n\n    init {\n        //default value\n        premium.value = false\n    }\n}\n```\n\n\n# Download\n\nAdd the repository\n```groovy\nrepositories {\n    maven { url  \"https://dl.bintray.com/florent37/maven\" }\n}\n```\n\n## common\n\n [ ![Download](https://api.bintray.com/packages/florent37/maven/multiplatform-livedata/images/download.svg) ](https://bintray.com/florent37/maven/multiplatform-livedata/_latestVersion)\n\n```groovy\nimplementation \"com.github.florent37:multiplatform-livedata:1.0.0\"\n```\n\n## ios\n\n [ ![Download](https://api.bintray.com/packages/florent37/maven/multiplatform-livedata/images/download.svg) ](https://bintray.com/florent37/maven/multiplatform-livedata/_latestVersion)\n\nUses a kotlin reimplementation of livedatas\n\n```groovy\nimplementation \"com.github.florent37:multiplatform-livedata-ios:1.0.0\"\n```\n\n## android\n\nUses inside the jetpack's LiveDatas\n\n [ ![Download](https://api.bintray.com/packages/florent37/maven/multiplatform-livedata/images/download.svg) ](https://bintray.com/florent37/maven/multiplatform-livedata/_latestVersion)\n\n```groovy\nimplementation \"com.github.florent37:multiplatform-livedata-android:1.0.0\"\n```\n\nYou can retrieve the real livedatas stored inside :\n```\nKLiveData\u003cT\u003e.toLivedata : LiveData\u003cT\u003e\n\nKMutableLiveData\u003cT\u003e.toMutableLiveData : MutableLiveData\u003cT\u003e\n\nKMediatorLiveData\u003cT\u003e.toMediatorLivedata : MediatorLivedata\u003cT\u003e\n```\n\nAnd create KLiveDatas from jetpacks LiveDatas\n\n```\nLiveData\u003cT\u003e.toKLivedata: KLiveData\u003cT\u003e\n\nMutableLiveData\u003cT\u003e.toKMutableLiveData: KMutableLiveData\u003cT\u003e\n\nMediatorLiveData\u003cT\u003e.toKMediatorLivedata: KMediatorLiveData\u003cT\u003e\n```\n \n## License\n        \n    Copyright 2018 Florent37\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n       http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorent37%2FMultiplatform-LiveData","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorent37%2FMultiplatform-LiveData","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorent37%2FMultiplatform-LiveData/lists"}