Anybody explain me how to handle mutable singletons in common module. Here is the changes that I add into kotlin-mpp-example:
https://github.com/KamiSempai/kotlin-mpp-example/commit/35627af6d4d3e1e0b7824adb708e9e0906db4a3c
I add a new one object Factory2 in common module that has lazy initialization of its properties. On android it works fine but in iOS i get InvalidMutabilityException.
Ok, I know that in Kotlin Native all singletons are freezed and I should use annotation ThreadLocal to make it mutable atleast in one thread. BUT this is common module. I can't use anything from Kotlin Native.
Does any practices that helps to solve such problems in common modules? Right now I only see that this immutability cut a lot of code which can be moved into common module.