• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jarroyoesp/KotlinMultiPlatform: Kotlin MultiPlatform App (Android, iOS, JVM &amp ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jarroyoesp/KotlinMultiPlatform

开源软件地址(OpenSource Url):

https://github.com/jarroyoesp/KotlinMultiPlatform

开源编程语言(OpenSource Language):

Kotlin 91.5%

开源软件介绍(OpenSource Introduction):

Kotlin-Multiplatform (Android, iOS, JS & JVM Desktop App)

kotlin-version kotlin-weekly

License: GPL v3

This 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.

In 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:

Tests:

  • MockK: mocking library for Kotlin

Android App - Master Branch

With this app you can get the weather of your locations using KTor:

And add and save on SQLDelight database your favourite locations:

iOS App

Open XCode and select the project:

JVM - Desktop App

To execute this version as desktop app, you have to execute this code on your console:

./gradlew JavaFxApp:run

By 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:

SQLDriver.kt
JdbcSqliteDriver("jdbc:sqlite:$your_database_path")

JS App

If you want to launch a web to get the weather you can try executing the next commands:

./gradlew JsApp:run
./gradlew BackEnd:run
--> localhost:8080

Current 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:

npm install core-js

I have followed these examples:

https://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html

https://www.raywenderlich.com/1022411-kotlin-multiplatform-project-for-android-and-ios-getting-started

https://proandroiddev.com/kotlin-multiplatform-very-beginners-guide-part-3-database-e34c92daf41c




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Hammie217/LatexJekyll: A latex document style website发布时间:2022-07-09
下一篇:
MCG-NKU/NSFC-LaTex发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap