Here is simplified example of what i'm trying to do. It work well, if all kotlin code is wrapped inside ios dedicated thread. But it become inconvenient when number of kotlin code grows, as each call to kotlin need to be wrapped in that specific thread.
There is background job that takes some time to get data with another swift library (1) and then retrieved data and existing data processed by kotlin code (2). Data volume is big, and we try to cast to kotlin datatypes whenever possible.
As result of processing small fraction is written back to swift data collection (3). Then UI update triggered (4). As part of it, there is another kotlin code, that need to be executed to format values (5).
Both kotlin components have internal mutable cache that used to reduce number of calculations. Cache is not exposed, but should persist between calls (thousands of objects, each with tens of primitives/maps/arrays).
Questions:
1. Is it even possible? I managed to do parts of it, but not everything together. E.g. without cache it works.
2. Will 1.3.60 somehow simplify things?
3. In which thread it is better to initialize kotlin?
Ultimate goal, is to provide certain functionality in libs, and let ios/android/etc devs to use them with less pain than now.