19
Kotlin 사용기 정경호

Kotlin 사용기

Embed Size (px)

Citation preview

Kotlin 사용기정경호

https://github.com/moltak/HeartbeatHue

자바를 사용하기도 했음

https://github.com/moltak/HeartbeatHue

https://github.com/moltak/HeartbeatHue

Kotlin으로 작은 프로젝트를 해보니

Kotlin 편하다!

Kotlin plugin 을 설치하면 한번에 Kotlin 프로젝트로 변경가능

자바 코드와 100% 호환 가능

JUnit Test

View Injection 사용(KotterKnife)

Null 처리 - Elvis operator

Null 처리 - Elvis operator

Elvis OperatorWhen we have a nullable reference r, we can say “if r is not null, use it, otherwise use some non-null value x”: -> null 레퍼런스 r을 갖고 있을 때, r이 null이면 사용하고 아니면 non-null value x를 사용하라

val l: Int = if (b != null) b.length else -1Along with the complete if-expression, this can be expressed with the Elvis operator, written ?::

val l = b?.length ?: -1

안드로이드 개발 때, 큰 문제가 없었다. 쉽게 적용 가능 했음.

Annotation 사용할 때는 문제가 있음 rxkotlin의 rxjava wrapping이 아직 미흡함.

Kotlin try on online

http://try.kotlinlang.org/#/Kotlin%20Koans/Introduction/Extension%20functions/Task.kt

Kotlin Koans

https://github.com/Kotlin/kotlin-koans

Kotlin Koans

https://github.com/Kotlin/kotlin-koans

Using Project Kotlin for Android - JakeWharton

https://docs.google.com/document/d/1ReS3ep-hjxWA8kZi0YqDbEhCqTt29hG8P44aA9W0DM8/edit?hl=ko&forcehl=1#