Sharing [Kotlin code across platforms] is caring! Eugenio Marletti - - PowerPoint PPT Presentation

sharing
SMART_READER_LITE
LIVE PREVIEW

Sharing [Kotlin code across platforms] is caring! Eugenio Marletti - - PowerPoint PPT Presentation

KotlinConf Sharing [Kotlin code across platforms] is caring! Eugenio Marletti @workingkills app app iOS Android frontend backend tools sharing


slide-1
SLIDE 1

@workingkills

Eugenio Marletti

Sharing

[Kotlin code across platforms]

is caring!

KotlinConf

slide-2
SLIDE 2

“app”

“ ”

“ ”

“ ”

“ ”

slide-3
SLIDE 3

“app”

iOS Android frontend backend tools

“ ”

“ ”

“ ”

“ ”

slide-4
SLIDE 4

sharing

slide-5
SLIDE 5

code sharing

slide-6
SLIDE 6

code sharing

slide-7
SLIDE 7

business logic sharing

slide-8
SLIDE 8

bugs sharing

slide-9
SLIDE 9

bugs sharing

slide-10
SLIDE 10

fixes sharing

slide-11
SLIDE 11

effort sharing

slide-12
SLIDE 12

C++ J2ObjC / GWT JavaScript

slide-13
SLIDE 13
slide-14
SLIDE 14

THE ALGORITHM™

slide-15
SLIDE 15

THE ALGORITHM™ C++ ObjC++ JavaScript TypeScript

slide-16
SLIDE 16

C++ ObjC++ JavaScript TypeScript iOS !" JavaScriptCore Android !" WebView

slide-17
SLIDE 17

C++ ObjC++ JavaScript TypeScript iOS !" JavaScriptCore Android !" W͊̊̏̃͑̽̃̕ ̘͖̯ ̨̺͇̯ ̶ȩ̧̟̝͔ ͔͎̗̬̼̓̒̄̍̓͐̒̎̕b̡̫̰͙͚͋͋̓́̇͟V͐̇͞ ̓̿̔̿̓ ̚ ͒ ͟ ̨̭̳̱͕ ̵ i ͒̅̉͊̌̇ ̡͓̰̲̳͟ ̥̯ ̯̦ę͕͔͉̜̗͔͎ ̔̍̀̏̌̕ ͢ ͟ w̛͊͆̍͑ ̴̯̯̻̪̦

slide-18
SLIDE 18

? C++ ObjC++ JavaScript TypeScript iOS !" JavaScriptCore Android !"

slide-19
SLIDE 19

THE ALGORITHM™ C++ ObjC++ JavaScript TypeScript Kotlin

@fbecart

Florent Bécart

slide-20
SLIDE 20

multi-platform

slide-21
SLIDE 21

header impl

(before 1.2)

  • Xmulti-platform
slide-22
SLIDE 22

header impl

(before 1.2)

  • Xmulti-platform
slide-23
SLIDE 23

expect actual

(from 1.2)

  • Xmulti-platform
slide-24
SLIDE 24

ANDROID WebView iOS JavaScriptCore BACKEND JS legacy.js

slide-25
SLIDE 25

legacy-test.js ANDROID WebView iOS JavaScriptCore BACKEND JS legacy.js shared-test.kt shared.kt

slide-26
SLIDE 26

legacy-test.js ANDROID WebView iOS JavaScriptCore BACKEND JS legacy.js shared-test.kt shared.kt

slide-27
SLIDE 27

legacy-test.js ANDROID WebView iOS JavaScriptCore BACKEND JS legacy.js shared-test.kt shared.kt

slide-28
SLIDE 28

legacy-test.js ANDROID WebView iOS JavaScriptCore BACKEND JS legacy.js shared.kt shared-test.kt

slide-29
SLIDE 29

legacy-test.js ANDROID WebView iOS JavaScriptCore BACKEND JS shared.kt shared-test.kt JVM

slide-30
SLIDE 30

/** * A day number, offset from 01/01/2012 !" export type Day = number

slide-31
SLIDE 31

/** * A day number, offset from 01/01/2012 !" typealias Day = Int

slide-32
SLIDE 32

class Value { constructor(value: Double) { this.value = value } val value: Double

  • verride fun toString(): String {

return this.value.toString() } companion object { fun add(v1: Value, v2: Value): Value { return Value(v1.value + v2.value) } fun isZero(valueWithVariance: Value): Boolean { return .0 !!% valueWithVariance.value } fun subtract(v1: Value?, v2: Value?): Value { var value = .0 if (v1 !' null !& v2 !' null) { value = v1.value - v2.value } return Value(value) } } } export class Value { constructor(value) { this.value = value } readonly value: number toString() { return String(this.value) } static add = (v1: Value, v2: Value): Value !$ { return new Value(v1.value + v2.value) } static isZero = (valueWithVariance: Value): boolean !$ { return 0 !!% valueWithVariance.value } static subtract = (v1: Value, v2: Value): Value !$ { let value = 0 if (v1 !& v2) { value = v1.value - v2.value } return new Value(value) } }

slide-33
SLIDE 33

< insert more talking here >

slide-34
SLIDE 34

Eugenio Marletti

@workingkills

BIT.LY/SHARING-KOTLIN-IS-CARING