touchlab / xcode-kotlin

Kotlin Native Xcode Plugin
https://touchlab.co/xcodekotlin
Apache License 2.0
1.16k stars 46 forks source link

not working with xcFramework #116

Open Zorodebug5 opened 6 days ago

Zorodebug5 commented 6 days ago

Hello,

  1. the documentation and installation steps and screenshots are too old specially after Xcode 16
  2. I did not how to add group if we are using only xcFramework , it is not clear how to ad group to the project root Pro1.xcodeproj
TadeasKriz commented 6 days ago

Hi, the installation should work the same way in Xcode 16. Just add your Kotlin souces to your Xcode project and make sure they are not added to any of the compilation targets. We prefer adding the source dir as a folder reference instead of a group, as that'll make sure you don't need to manually add any new Kotlin files.

As long as your XCFramework is built on the same machine your sources live on, it'll work the same as a regular framework. If you're building the code on a different machine, that usually means the source paths are different and you'll have to manually map files using an LLDB command. That's out of scope for Xcode-Kotlin at this time.

kpgalligan commented 6 days ago

I'll double-down here. The important points:

If your XCFramework is not built on your machine, you won't be able to debug it. That's not a Kotlin-specific issue. We published a post about KMP and teams related to this: https://touchlab.co/kmp-teams-use-source

Yes, there are ways to map paths, but they're pretty painful to set up.

If the Kotlin code was built locally, well, different story. You could put a breakpoint in Swift code before calling Kotlin and try to keep "stepping in". That might help diagnose path issues, if any.

Zorodebug5 commented 6 days ago

thank you very much , I make some progress

however, I wants some help to make my project works with xcode-kotlin right now if I put a break point in commonMain it will take my to the line and open debug mode, but if the crash occurs in commonMain it will not take me to the line of the crash as it was doing before

Screenshot 2024-09-23 at 23 56 55
TadeasKriz commented 5 days ago

Could you share a screenshot of a crash? Usually you need to select the correct frame in the left panel in Xcode, so if you share the screenshot I might be able to navigate you to it.

Zorodebug5 commented 5 days ago

thank you, there is no crash but when Kotlin code throws , xcode-kotlin does not take me to the crashed lined as it was doing before