Extension properties

Published: March 7, 2022

You are probably familiar with extension functions in Kotlin.

kotlin
class Count(var value: Int)

fun Count.double() = value * 2

But you can also have extension properties.

kotlin
val Count.double: Int
  get() = value * 2