{"id":15316705,"url":"https://github.com/albert-gao/kotlin-native-mobile-multiplatform-example","last_synced_at":"2025-04-15T02:20:45.081Z","repository":{"id":129076309,"uuid":"122153574","full_name":"Albert-Gao/kotlin-native-mobile-multiplatform-example","owner":"Albert-Gao","description":"Code sharing between iOS and Android with Kotlin native","archived":false,"fork":false,"pushed_at":"2018-05-15T04:12:05.000Z","size":348,"stargazers_count":52,"open_issues_count":2,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T14:11:09.430Z","etag":null,"topics":["android","android-studio","boilerplate","code-sharing","gradle","ios","kotlin","native","template","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Albert-Gao.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-20T04:04:52.000Z","updated_at":"2021-07-24T20:50:34.000Z","dependencies_parsed_at":"2023-04-10T16:50:37.935Z","dependency_job_id":null,"html_url":"https://github.com/Albert-Gao/kotlin-native-mobile-multiplatform-example","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"7d3ec62354f3a60b8189bbe717cc02187643248c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2Fkotlin-native-mobile-multiplatform-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2Fkotlin-native-mobile-multiplatform-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2Fkotlin-native-mobile-multiplatform-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2Fkotlin-native-mobile-multiplatform-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Albert-Gao","download_url":"https://codeload.github.com/Albert-Gao/kotlin-native-mobile-multiplatform-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248991709,"owners_count":21194925,"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","android-studio","boilerplate","code-sharing","gradle","ios","kotlin","native","template","xcode"],"created_at":"2024-10-01T08:54:43.856Z","updated_at":"2025-04-15T02:20:45.062Z","avatar_url":"https://github.com/Albert-Gao.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotlin Native mobile multiplatform example\n\nThere is a cross more platforms version (added JVM and JS) in this [repo](https://github.com/Albert-Gao/kotlin-multuplatform-including-mobile)\n\nRead my [blog](http://www.albertgao.xyz/2018/02/22/use-kotlin-to-share-native-code-between-ios-and-android/) if you want more details:\n\n## Overview\n\nThis is an example of using Kotlin native to share the code between iOS and Android. It contains the tests for all the platform code. Setup via the support from multiplatform kotlin.\n\nThis setup is aiming to solve the problem, where we want to write the platform specific code in a `multiplatform` manner.\n\n## Folders\n\n- android: Android project built by Android Studio\n- ios: iOS Project built by XCode\n- common: Kotlin code that is meant to be across platform across all platforms without any change.\n- platforms: platform specific API which will then be compiled with `common`\n    - android: Some platform specific code for android, which will be included in the android folder\n    - ios: Some platform specific code for iOS, it will be compiled as an iOS framework\n    \n## Workflow:\n\n- Work on Android App: Open `android` folder in Android Studio\n- Work on iOS App: Open `ios` folder in XCode\n- Work on sharing code: Open the root folder in `IDEA` or any other IDE.\n\n\u003e In fact, you can edit the sharing code in android studio as well, as we embed them as module, and they all use the same language.\n\n## About the example\n\n- `Sample` class is for code that is sharing across platforms (Which means you only use API from `kotlin-stdlib-common` or some other cross platform lib).\n- `Platform` class is a class which has been implemented twice for different platforms for showing the platform API case.\n\n- Open `android` folder from the root in Android Studio, run the app, it will show a string from the `:platforms-android`\n- Open `ios` folder from the root in XCode, run the app, it will show a string from the `:platforms-ios`\n- And the string is from both platforms are retrieved from the `Sample` class.\n\n## Tips\n\nIf you think the XCode building phase is slow. That is because it will build the KN generated iOS framework every time. You can modify it by just copying the framework files without building it. Because you can always edit Kotlin native code somewhere else.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbert-gao%2Fkotlin-native-mobile-multiplatform-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbert-gao%2Fkotlin-native-mobile-multiplatform-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbert-gao%2Fkotlin-native-mobile-multiplatform-example/lists"}