{"id":30144140,"url":"https://github.com/icerockdev/moko-units","last_synced_at":"2026-02-22T18:01:35.339Z","repository":{"id":42509106,"uuid":"214579366","full_name":"icerockdev/moko-units","owner":"icerockdev","description":"Composing units into list and show in RecyclerView/UITableView/UICollectionView. Control your lists from common code for mobile (android \u0026 ios) Kotlin Multiplatform development","archived":false,"fork":false,"pushed_at":"2022-04-02T05:54:10.000Z","size":473,"stargazers_count":26,"open_issues_count":5,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-11T07:48:37.112Z","etag":null,"topics":["android","cocoapod","ios","kotlin","kotlin-multiplatform","kotlin-native","moko","recyclerview","uicollectionview","uitableview"],"latest_commit_sha":null,"homepage":"https://moko.icerock.dev/","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/icerockdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-12T04:48:09.000Z","updated_at":"2025-04-25T17:10:55.000Z","dependencies_parsed_at":"2022-09-26T22:01:48.857Z","dependency_job_id":null,"html_url":"https://github.com/icerockdev/moko-units","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/icerockdev/moko-units","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-units","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-units/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-units/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-units/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icerockdev","download_url":"https://codeload.github.com/icerockdev/moko-units/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icerockdev%2Fmoko-units/sbom","scorecard":{"id":480088,"data":{"date":"2025-08-11","repo":{"name":"github.com/icerockdev/moko-units","commit":"a8f608eddfab76e9d5e99d982dd23466a04e16ce"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Code-Review","score":4,"reason":"Found 3/7 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/compilation-check.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/compilation-check.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-units/compilation-check.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/compilation-check.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-units/compilation-check.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/compilation-check.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-units/compilation-check.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-units/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-units/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/icerockdev/moko-units/publish.yml/master?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T16:23:07.829Z","repository_id":42509106,"created_at":"2025-08-19T16:23:07.830Z","updated_at":"2025-08-19T16:23:07.830Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29721046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T15:10:41.462Z","status":"ssl_error","status_checked_at":"2026-02-22T15:10:04.636Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","cocoapod","ios","kotlin","kotlin-multiplatform","kotlin-native","moko","recyclerview","uicollectionview","uitableview"],"created_at":"2025-08-11T07:38:07.548Z","updated_at":"2026-02-22T18:01:35.328Z","avatar_url":"https://github.com/icerockdev.png","language":"Kotlin","readme":"![moko-units](img/logo.png)  \n[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/units) ](https://repo1.maven.org/maven2/dev/icerock/moko/units) ![kotlin-version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=dev.icerock.moko\u0026name=units)\n\n# Mobile Kotlin units\nThis is a Kotlin MultiPlatform library that provides RecyclerView/UITableView/UICollectionView filling from common code.\n\n## Table of Contents\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Samples](#samples)\n- [Set Up Locally](#set-up-locally)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n- **Control UI lists from common code** - content for `RecyclerView`/`UITableView`/`UICollectionView`\n creating from common kotlin code.\n\n## Requirements\n- Gradle version 6.8+\n- Android API 16+\n- iOS version 11.0+\n\n## Installation\nroot build.gradle  \n```groovy\nbuildscript {\n    repositories {\n        gradlePluginPortal()\n    }\n\n    dependencies {\n        classpath(\"dev.icerock.moko:units-generator:0.8.0\")\n    }\n}\n\n\nallprojects {\n    repositories {\n       mavenCentral()\n    }\n}\n```\n\nproject build.gradle\n```groovy\ndependencies {\n    commonMainApi(\"dev.icerock.moko:units:0.8.0\")\n    commonMainImplementation(\"dev.icerock.moko:units-basic:0.8.0\")\n\n    commonTestImplementation(\"dev.icerock.moko:units-test:0.8.0\")\n}\n```\n\nOn iOS, in addition to the Kotlin library add Pod in the Podfile.\n```ruby\npod 'MultiPlatformLibraryUnits', :git =\u003e 'https://github.com/icerockdev/moko-units.git', :tag =\u003e 'release/0.8.0'\n```\n**`MultiPlatformLibraryUnits` CocoaPod requires that the framework compiled from Kotlin be named \n`MultiPlatformLibrary` and be connected as a CocoaPod `MultiPlatformLibrary`. \n[Here](sample/ios-app/Podfile)'s an example.\nTo simplify integration with MultiPlatformFramework you can use [mobile-multiplatform-plugin](https://github.com/icerockdev/mobile-multiplatform-gradle-plugin)**.  \n`MultiPlatformLibraryUnits` CocoaPod contains an swift additions for `UnitDataSource`s of `UITableView`/`UICollectionView`.\n\nIn android build.gradle\n\ndatabinding usage\n```\napply plugin: \"dev.icerock.mobile.multiplatform-units\"\n\ndependencies {\n    implementation(\"dev.icerock.moko:units-databinding:0.8.0\")\n}\n\nmultiplatformUnits {\n    classesPackage = \"org.example.library.units\"\n    dataBindingPackage = \"org.example.library\"\n    layoutsSourceSet = \"main\"\n}\n```\n\nviewbinding usage \n```\ndependencies {\n    implementation(\"dev.icerock.moko:units-viewbinding:0.8.0\")\n}\n```\n\n## Usage\ncommon:\n```kotlin\ninterface UnitFactory {\n    fun createHeader(text: String): TableUnitItem\n    fun createProfileTile(profileId: Long, avatarUrl: String, username: String): TableUnitItem\n}\n\nclass ViewModel(unitFactory: UnitFactory) {\n    val items = listOf(\n        unitFactory.createHeader(\"Programmers\"),\n        unitFactory.createProfileTile(1, \"url\", \"Mikhailov\"),\n        unitFactory.createProfileTile(2, \"url\", \"Babenko\"),\n        unitFactory.createProfileTile(3, \"url\", \"Tchernov\"),\n        unitFactory.createHeader(\"Designers\"),\n        unitFactory.createProfileTile(4, \"url\", \"Eugeny\")\n    )\n}\n```\n\nandroid with databinding (using module units-databinding)\n```xml\n\u003candroidx.recyclerview.widget.RecyclerView\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"match_parent\"\n            app:bindValue=\"@{viewModel.items}\"\n            app:adapter=\"@{`dev.icerock.moko.units.adapter.UnitsRecyclerViewAdapter`}\"\n            app:layoutManager=\"androidx.recyclerview.widget.LinearLayoutManager\"/\u003e\n```\n```kotlin\nobject UnitFactoryImpl: UnitFactory {\n    fun createHeader(text: String): TableUnitItem {\n        return LayoutHeader()\n            .setText(text)\n            .setItemId(text.hashCode())\n    }\n    \n    fun createProfileTile(profileId: Long, avatarUrl: String, username: String): TableUnitItem {\n        return LayoutProfileTile()\n            .setAvatarUrl(avatarUrl)\n            .setUserName(username)\n            .setItemId(profileId)\n    }\n}\n```\n```kotlin\nmBinding.viewModel = ViewModel(UnitFactoryImpl)\n```\n\nandroid with viewbinding (using module units-viewbinding)\n```xml\n\u003cLinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:orientation=\"vertical\"\u003e\n\n    \u003cTextView\n        android:id=\"@+id/unit_blue_divider_textView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:background=\"#2196F3\" /\u003e\n\u003c/LinearLayout\u003e\n```\nFor every `unit_layout.xml` should create class using viewbinding-generated class `UnitLayoutBinding`\n```kotlin\nclass UnitBlueDivider(override val itemId: Long) :\n    VBTableUnitItem\u003cUnitBlueDividerBinding\u003e() {\n\n    override val layoutId: Int = R.layout.unit_blue_divider\n\n    override fun bindView(view: View): UnitBlueDividerBinding {\n        return UnitBlueDividerBinding.bind(view)\n    }\n\n    override fun UnitBlueDividerBinding.bindData(\n        context: Context,\n        lifecycleOwner: LifecycleOwner,\n        viewHolder: VBViewHolder\u003cUnitBlueDividerBinding\u003e\n    ) {\n        this.unitBlueDividerTextView.setBackgroundColor(Color.parseColor(\"#2196F3\"))\n    }\n}\n\noverride fun createBlueDividerUnit(id: Long): TableUnitItem {\n    return UnitBlueDivider(\n        itemId = id\n    )\n}\n```\n\nOn Android you can use units with viewbinding or with databinding, just plug in the corresponding module: `units-viewbinding` or `units-databinding` \n\niOS:\n```swift\nclass UnitFactoryImpl: NSObject, UnitFactory {\n\n  func createHeader(text: String) -\u003e TableUnitItem {\n    let data = HeaderTableViewCell.CellModel(text: text)\n    return UITableViewCellUnit\u003cHeaderTableViewCell\u003e(\n      data: data,\n      itemId: text.hashCode(),\n      configurator: nil)\n  }\n  \n  func createProfileTile(profileId: Long, avatarUrl: String, username: String) -\u003e TableUnitItem {\n    let data = ProfileTableViewCell.CellModel(avatarUrl: avatarUrl, username: username)\n    return UITableViewCellUnit\u003cProfileTableViewCell\u003e(\n      data: data,\n      itemId: profileId,\n      configurator: nil)\n  }\n}\n```\n```swift\nlet viewModel = ViewModel(unitFactory: UnitFactoryImpl())\nlet tableDataSource = TableUnitsSourceKt.default(for: tableView)\ntableDataSource.unitItems = viewModel.items\ntableView.reloadTable()\n```\n\n### Different unit's UI in dropdown list with units-viewbinding\nIf you want to use units in dropdown list you should implement `DropDownUnitItem`. Abstract class `VBDropDownUnitItem` already implement it so you can use it. \nIf you want the units UI will be different when dropdown list is close or open, you need to implement another interface `TableUnitItem` which already implemented in `VBTableUnitItem`.\nThe sample you can see [here](https://github.com/icerockdev/moko-units/tree/master/sample/android-viewbinding/src/main/java/com/icerockdev/UnitSimpleDropdown.kt)\n\n### Different unit's UI in dropdown list with units-databinding\nOnly what you need to make different UI to units in closed and open dropdown list with databinding is an another layout with _dropdown postfix\n`sample_unit.xml` for sample unit, `sample_unit_dropdown.xml` for dropdown unit  \n\n## Samples\nPlease see more examples in the [sample directory](sample).\n\n## Set Up Locally \n- The [units directory](units) contains the `units` library;\n- The [gradle-plugin directory](gradle-plugin) contains a gradle plugin with a `MR` class generator;\n- The [sample directory](sample) contains sample apps for Android and iOS; plus the mpp-library connected to the apps.\n\n## Contributing\nAll development (both new features and bug fixes) is performed in the `develop` branch. This way `master` always contains the sources of the most recently released version. Please send PRs with bug fixes to the `develop` branch. Documentation fixes in the markdown files are an exception to this rule. They are updated directly in `master`.\n\nThe `develop` branch is pushed to `master` on release.\n\nFor more details on contributing please see the [contributing guide](CONTRIBUTING.md).\n\n## License\n        \n    Copyright 2019 IceRock MAG Inc.\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficerockdev%2Fmoko-units","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficerockdev%2Fmoko-units","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficerockdev%2Fmoko-units/lists"}