You access a top-level property via the wrapper class: TopLevelMutablePropertyKt.topLevelProperty.
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"