r

    Ron

    11 months ago
    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?
    Matthew Kruk

    Matthew Kruk

    11 months ago
    Check out this touchlab library. It's excellent for concurrency. They have multiplatform methods for .freeze() and atomics: https://github.com/touchlab/Stately
    r

    Ron

    11 months ago
    Thanks! I'll try that