Hello
I'm using a Swift wrapper around my K/N library and have the common InvalidMutabilityException
I have a reference of a Kotlin object in a Swift class: when I call a method (that mutates its state) on it, it throws the exception which seems logical as it is frozen by default. I used the @ThreadLocal annotation on the variable that is changed by the method but nothing changes.
My question is: how can I tell K/N runtime that my Kotlin object reference should be "ThreadLocal" from a Swift class?
Thank you
d
Dominaezzz
04/20/2020, 2:10 PM
You have to annotate the entire
object
not just the field.
r
Romain Dubreucq
04/20/2020, 2:25 PM
Thanks for you answer.
But I still have the exception đ
On Swift side, I'm initializing K/N runtime and my Kotlin object on the same background queue. I'm also calling the method from this queue. Does it sound right to you?