Hi! I want to create an immutable object in kotlin multiplatform (ios/android) so it could be shared between threads in swift. can anyone help me? I tried to add
@SharedImmutable
to properties in a class but got this error:
SharedImmutable is applicable only for top level declarations
. Also tried to run
.freeze()
but this function is not available. what am I missing?
m
Matthew Kruk
10/21/2021, 4:06 PM
Check out this touchlab library. It's excellent for concurrency. They have multiplatform methods for .freeze() and atomics: https://github.com/touchlab/Stately