Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 589 Bytes

File metadata and controls

26 lines (17 loc) · 589 Bytes

Constructors

You call constructors to create Kotlin classes from Swift.

Explanations

Let's declare a simple class on the Kotlin code side:

//UsualClassConstructor.kt

class UsualClassConstructor(
    val param: String
)

On the Swift side, we will get the same class with a main constructor, in which primitive types will be converted:

let _ = UsualClassConstructor(param: "123")

A slight difference from Kotlin classes: in the Swift version, all constructor fields must be named.


Table of contents