Could someone help me with a Swift - Kotlin Intero...
# ios
j
Could someone help me with a Swift - Kotlin Interop issue in a KMP project? It involves Swift - Kotlin Interop between NSMutableArray(Swift) and ArrayList(Kotlin) I am having a function “sampleFuncForStringArrayList(names: ArrayList<String>)” in KMP module which prints its count and iterates and prints ArrayList items. When I call this function from the iOS sample app. I am getting index out of bound exception  Because NSMutableArray count which is 2 in iOS app environment, has count as 24576 when received as ArrayList in KMP module.
a
First of all, I would ask to avoid cross-posting if possible. Just tried to add code from the gist to an existing project and got this:
Copy code
NSMutableArray COUNT : 2
names.isNullOrEmpty() false
names.count 2
Hello: Hello
Hello: doctor
Now I’m looking at the archive, maybe there is something specific.
Reproduced. My only guess for now is there is something related to the common source set.
j
@Artyom Degtyarev [JB] Is there any particular reason to avoid cross-posting?
And, Did you reproduce from the archive sample project or in the project which you added code from Gist?
a
Sorry, forgot to tell the problem appeared for the archive. Anyway, now I managed to localize the problem, and it reproduces on a simple code example. Going to make a YouTrack issue now. The problem seems to be caused by something wrong in the release mode. The project with the release framework fails, but the debug one works as expected. So, as a temporary workaround, you can stick to the debug framework. About cross-posting - while there is no such a rule in the guideline, I’m usually asking to avoid it. The reason here is that those channels share almost all their members, so, instead of involving more users in your case, it can just annoy people.
j
Thanks @Artyom Degtyarev [JB] I've filed the YouTrack issue. https://youtrack.jetbrains.com/issue/KT-41813. Please merge into this.