Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 925 Bytes

Top-level mutable var properties.md

File metadata and controls

30 lines (19 loc) · 925 Bytes

Top-level var properties (mutable)

You access a top-level property via the wrapper class: TopLevelMutablePropertyKt.topLevelProperty.

Explanations

We describe the top-level var property in Kotlin in file TopLevelPropertyMutable.kt:

//TopLevelPropertyMutable.kt

var topLevelPropertyMutable = "Some value"

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 TopLevelPropertyMutableKt (file name in Kotlin + suffix Kt), with which you can access the desired property:

let _ = TopLevelPropertyMutableKt.topLevelPropertyMutable

The property is mutable:

TopLevelPropertyMutableKt.topLevelPropertyMutable = "Changed from Swift"

Table of contents