How can I write something in Kotlin Native that I ...
# kotlin-native
a
How can I write something in Kotlin Native that I can call like a static method from Swift? I want the call site to look like
SomeClass.staticMethod()
.
m
in Kotlin Native, you can create functions in kotlin files and call like:
MyFileKt.someFunction()
just create a kotlin file called:
MyFile.kt
a
Thanks! 🙂
👍 1
n
You can also do that 🙂
Copy code
object SomeClass {
   fun staticMethod() {}
}
a
@Nicolas Chevalier But then you have to initialize the object so the call looks like:
SomeClass().staticMethod()
m
object
in kotlin is a singleton, already initialized, but I don't know how it behaves in Swift
I think you can do:
SomeClass.staticMethod()
let's test it....