{"id":15069227,"url":"https://github.com/jarroyoesp/kotlinmultiplatform","last_synced_at":"2025-04-04T20:09:50.718Z","repository":{"id":49399891,"uuid":"185386010","full_name":"jarroyoesp/KotlinMultiPlatform","owner":"jarroyoesp","description":"Kotlin MultiPlatform App (Android, iOS, JVM \u0026 JS). MVVM/MVP - Kotlin MultiPlatform","archived":false,"fork":false,"pushed_at":"2020-04-20T08:50:55.000Z","size":2754,"stargazers_count":765,"open_issues_count":3,"forks_count":66,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-04-04T20:09:46.000Z","etag":null,"topics":["android","dagger","ios","jvm","kotlin","kotlin-android","kotlin-coroutines","kotlin-multiplatform","ktor","multiplatform","mvvm-architecture","objective-c","sqldelight","swift"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jarroyoesp.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}},"created_at":"2019-05-07T11:17:48.000Z","updated_at":"2025-02-27T06:08:00.000Z","dependencies_parsed_at":"2022-08-31T01:01:21.084Z","dependency_job_id":null,"html_url":"https://github.com/jarroyoesp/KotlinMultiPlatform","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/jarroyoesp%2FKotlinMultiPlatform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarroyoesp%2FKotlinMultiPlatform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarroyoesp%2FKotlinMultiPlatform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jarroyoesp%2FKotlinMultiPlatform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jarroyoesp","download_url":"https://codeload.github.com/jarroyoesp/KotlinMultiPlatform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242678,"owners_count":20907134,"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","dagger","ios","jvm","kotlin","kotlin-android","kotlin-coroutines","kotlin-multiplatform","ktor","multiplatform","mvvm-architecture","objective-c","sqldelight","swift"],"created_at":"2024-09-25T01:41:12.454Z","updated_at":"2025-04-04T20:09:50.703Z","avatar_url":"https://github.com/jarroyoesp.png","language":"Kotlin","readme":"# Kotlin-Multiplatform (Android, iOS, JS \u0026 JVM Desktop App)\n![kotlin-version](https://img.shields.io/badge/kotlin-1.3.50-orange)\n\u003ca target=\"_blank\" href=\"https://androidweekly.net/issues/issue-397\"\u003e\u003cimg src=\"https://androidweekly.net/issues/issue-397/badge\"\u003e\u003c/a\u003e\n\u003ca target=\"_blank\" href=\"https://androidweekly.net/issues/issue-380\"\u003e\u003cimg src=\"https://androidweekly.net/issues/issue-380/badge\"\u003e\u003c/a\u003e\n![kotlin-weekly](https://img.shields.io/endpoint?label=Kotlin-Weekly%20%23165\u0026style=plastic\u0026url=https%3A%2F%2Fmailchi.mp%2Fkotlinweekly%2Fkotlin-weekly-165)\n\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\nThis example shows how to create a simple Android/iOS/JVM/JS project sharing some Kotlin code. This app saves on a local database your favourites locations and get the current weather of them from OpenWeatherMap.\n\nIn this app we share common code for both platforms (Android/iOS) to get data from an API (in this case OpenWeatherMap). The libraries that we use are:\n\n- [KTOR](https://github.com/ktorio/ktor): to make HTTP requests\n- [Serialization](https://github.com/Kotlin/kotlinx.serialization): to De/Serializing JSON \n- [SqlDelight](https://github.com/square/sqldelight): Local database shared between Android \u0026 iOS \n\nTests:\n\n- [MockK](https://mockk.io/#gradlemaven-dependency): mocking library for Kotlin\n\n\u003cimg src=\"https://github.com/jarroyoesp/KotlinMultiPlatform/blob/master/images/GetLocationDiagram.png\"\u003e\n\n### Android App - Master Branch\n\nWith this app you can get the weather of your locations using KTor:\n\n\u003cimg src=\"https://github.com/jarroyoesp/KotlinMultiPlatform/blob/master/images/AndroidCaptureWeather.png\" width=\"200\"\u003e\n\nAnd add and save on SQLDelight database your favourite locations:\n\n\u003cimg src=\"https://github.com/jarroyoesp/KotlinMultiPlatform/blob/master/images/AndroidCaptureLocationList.png\" width=\"200\"\u003e\n\n### iOS App\n\nOpen XCode and select the project:\n\n\u003cimg src=\"https://github.com/jarroyoesp/KotlinMultiPlatform/blob/master/images/iOS_App.png\" width=\"200\"\u003e\n\n### JVM - Desktop App\n\nTo execute this version as desktop app, you have to execute this code on your console:\n\n```\n./gradlew JavaFxApp:run\n```\nBy default the JDBC SQLite is created in memory. If you want to persist your database in your disk, you have to indicate the path when you create the database driver:\n\n```\nSQLDriver.kt\nJdbcSqliteDriver(\"jdbc:sqlite:$your_database_path\")\n```\n\n\u003cimg src=\"https://github.com/jarroyoesp/KotlinMultiPlatform/blob/master/images/JVMApp.png\" width=\"800\"\u003e\n\n### JS App \n\nIf you want to launch a web to get the weather you can try executing the next commands:\n\n```\n./gradlew JsApp:run\n./gradlew BackEnd:run\n--\u003e localhost:8080\n```\n\nCurrent weather is not shown when you launch the browser? If you have this problem (Module not found: Error: Can't resolve 'core-js/features/object/assign') try to reinstall the node module core-js:\n```\nnpm install core-js\n```\n\n\u003cimg src=\"https://github.com/jarroyoesp/KotlinMultiPlatform/blob/master/images/jsApp.png\" width=\"400\"\u003e\n\nI have followed these examples:\n\nhttps://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html\n\nhttps://www.raywenderlich.com/1022411-kotlin-multiplatform-project-for-android-and-ios-getting-started\n\nhttps://proandroiddev.com/kotlin-multiplatform-very-beginners-guide-part-3-database-e34c92daf41c\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarroyoesp%2Fkotlinmultiplatform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjarroyoesp%2Fkotlinmultiplatform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjarroyoesp%2Fkotlinmultiplatform/lists"}