Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 787 Bytes

Top-level functions.md

File metadata and controls

26 lines (17 loc) · 787 Bytes

Top-level functions

You can access a top-level function via the wrapper class: TopLevelFunctionKt.topLevelFunction().

Explanations

Let's describe the top-level function in Kotlin in the file TopLevelFunction.kt:

//TopLevelFunction.kt

fun topLevelFunction() {
    println("Hello from top-level function")
}

In Kotlin, similar code can be called directly, without specifying the file name, just specify import the desired property.

On the Swift side, we get a wrapper class TopLevelFunctionKt (file name in Kotlin + suffix Kt), with which you can access the desired function:

TopLevelFunctionKt.topLevelFunction()

Table of contents