Slide 1

Slide 1 text

Kotlin iOS Debugging Kevin Galligan

Slide 2

Slide 2 text

Partner at

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Features • Kotlin Source recognition and coloring • Add breakpoints • Interactive debugging

Slide 10

Slide 10 text

Xcode Demo!

Slide 11

Slide 11 text

Dev Version about 1/3 slower than earlier version

Slide 12

Slide 12 text

3 Main Pieces

Slide 13

Slide 13 text

Kotlin.xcplugindata tells Xcode that *.kt is source

Slide 14

Slide 14 text

Kotlin.xclangspec color file (tweaked from Java, TBH)

Slide 15

Slide 15 text

konan_lldb.py lldb formatter (where the magic happens)

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Adding Kotlin Files to Xcode spoilers: the hard part

Slide 22

Slide 22 text

xcode doesn’t “see” your folders

Slide 23

Slide 23 text

you must add them

Slide 24

Slide 24 text

Source or Resource?

Slide 25

Slide 25 text

Options

Slide 26

Slide 26 text

1) Manually Add Them spoiler: meh

Slide 27

Slide 27 text

2) Gradle Plugin better

Slide 28

Slide 28 text

xcode { projectPath = "../../iosApp/iosApp.xcodeproj" target = "iosApp" } apply plugin: 'co.touchlab.kotlinxcodesync'

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Work in progress!

Slide 31

Slide 31 text

3) Cocoapods probably best option in near future…

Slide 32

Slide 32 text

https://github.com/touchlab/DroidconKotlin/

Slide 33

Slide 33 text

AppCode?

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

AppCode Demo!

Slide 36

Slide 36 text

PR Ready! almost

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

What’s Next?

Slide 40

Slide 40 text

Performance!

Slide 41

Slide 41 text

Better Formats

Slide 42

Slide 42 text

this is a map?

Slide 43

Slide 43 text

Other Stuff

Slide 44

Slide 44 text

RUNTIME_USED int32_t Konan_DebugObjectToUtf8Array(KRef obj, char* buffer, int bufferSize); // Print to console string representation of an object. RUNTIME_USED int32_t Konan_DebugPrint(KRef obj); // Returns 1 if obj refers to an array, string or binary blob and 0 otherwise. RUNTIME_USED int Konan_DebugIsArray(KRef obj); // Returns number of fields in an objects, or elements in an array. RUNTIME_USED int Konan_DebugGetFieldCount(KRef obj); // Compute type of field or an array element at the index, or 0, if incorrect, // see Konan_RuntimeType. RUNTIME_USED int Konan_DebugGetFieldType(KRef obj, int index); // Compute address of field or an array element at the index, or null, if incorrect. RUNTIME_USED void* Konan_DebugGetFieldAddress(KRef obj, int index); // Compute address of field or an array element at the index, or null, if incorrect. RUNTIME_USED const char* Konan_DebugGetFieldName(KRef obj, int index);

Slide 45

Slide 45 text

[email protected] @kpgalligan https://medium.com/@kpgalligan