toImmutable

Returns an immutable instance of an object.

On Android, it simply echoes the input back because threads can have shared state. On iOS, it calls .toImmutable method.

Examples

val person = Person(name = "Bob").toImmutable(

person.name = "Jerry" // error

common
fun <T> T.toImmutable(): T
ios
fun <T> T.toImmutable(): T