Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Multiplatform Kotlin

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
44
August 09, 2018

Multiplatform Kotlin

44

August 09, 2018

Transcript

32 slides
  1. 自己紹介 ヤマサキ ヨシヒロ 山崎 好洋 ヤフー株式会社 18年 新卒 • Kotlin

    • DDD(ドメイン駆動設計) • TDD(テスト駆動開発) • モブプログラミング @44x1carbon
  2. expectとactual 各プラットフォーム毎で実装したいクラスはexpectキーワードを使って定義する expect class DateTime : Comparable<DateTime> { val second:

    Int val minute: Int val hour: Int val dayOfMonth: Int val monthOfYear: Int val year: Int fun toDateFormatString(): String operator fun plus(millis: Long): DateTime }
  3. expectとactual JvmであればCalenderクラス、JavaScriptならDateクラスを用いて実装する import kotlin.js.Date actual data class DateTime( actual val

    second: Int, actual val minute: Int, actual val hour: Int, actual val dayOfMonth: Int, actual val monthOfYear: Int, actual val year: Int ) : Comparable<DateTime> { actual fun toDateFormatString(): String = DATE_FORMAT... override operator fun compareTo(other: DateTime): Int = compareValuesBy(this, other, ... actual operator fun plus(millis: Long): DateTime { val date = Date(year, monthOfYear, dayOfMonth, hour, minute, second) val newDate = Date(date.getUTCMilliseconds() + millis) return DateTime(newDate.getSeconds(), ...) } }
  4. JSON kotlinx.serialization common-client RepositoryInterface common-client Presenter backend API common DataModel

    web View iOS View Android View common-client ViewInterface common-client-* Repository

More Decks by 44

Other Decks in Technology