Some autogenerated functions are converted to Swift: copy
to doCopy
, equals
to isEquals
, toString
to description
. Additional features, like destructuring, are not supported.
Let's describe the usual data class in Kotlin:
data class DataClass(
val param1: String,
val param2: Int,
val param3: Boolean
)
The function copy is converted to Swift with the name doCopy
, and works similarly to the function in Kotlin, but there is an inconvenience with the need to specify all the function arguments.
Comparing two instances of a data class works similarly to Kotlin, including comparing collections. The equivalent function is isEquals
in Swift.
When using a data class object in a line, the output is the same as in Kotlin:
let data = DataClass(param1: "abc", param2: 123, param3: true)
print("data = \(data)")
The equivalent function is description
in Swift.
This feature is not supported.
---
[Table of contents](/README.md)