Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 544 Bytes

Extension properties over usual class.md

File metadata and controls

24 lines (15 loc) · 544 Bytes

Extension properties over usual class

The property can be accessed through the class object.

Explanations

Let's declare an extension property for a custom type in Kotlin code:

//ExtensionPropertyUsualClass.kt

class ExtensionPropertyUsualClass {}

val ExtensionPropertyUsualClass.extensionProperty: String get() = "123"

On the Swift side, we can use this property similarly to Kotlin, on an object of the desired class:

ExtensionPropertyUsualClass().extensionProperty

Table of contents