Vlad Ivanov
12/24/2020, 8:16 PMdata class Foo(val bars: List<Bar>)
// create instance of Foo with bars on Swift side and pass it to some Kotlin Multiplatform class where I call
foo.freeze()
// now I expect that bars are frozen, but they are not
// as a workaround I use
foo.bars.forEach { it.freeze() }
When I do the same purely in Kotlin - everything works as expected, instance of Foo is frozen and all its propertiesArtyom Degtyarev [JB]
12/25/2020, 7:28 AMVlad Ivanov
12/27/2020, 12:13 PMVlad Ivanov
01/25/2021, 10:07 AMNikolay Kasyanov
04/29/2021, 7:51 AMsvyatoslav.scherbina
04/29/2021, 9:14 AMOne idea I came up with is use KotlinArray instead of a List to get deep-freezing as expected.This should work. Alternatively, you can instantiate a List in Kotlin. In particular, creating Swift array (in Swift) and copying it in Kotlin with
.toList()
should work.