https://kotlinlang.org logo
#touchlab-tools
Title
# touchlab-tools
s

SrSouza

09/06/2023, 5:10 PM
Hi folks, is possible or there any planning of support by hand Swift code (extensions, util functions) that are not exacly generated, instead is create by hand. For example, functions annotated with https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.native/-should-refine-in-swift/ in Kotlin being able to directly create the counter party refined swift function and delivery this to the iOS team. Is really amazing the SKIE compatibility of in the same Framework contain the SWIFT generate code and Kotlin Native (objc) code.
1
k

kpgalligan

09/06/2023, 9:15 PM
It would be possible to include just Swift code and compile it. The team has discussed this. One issue is that the Swift doesn't know what the final Kotlin names will be until the compiler runs, so the hand-written Swift code can't really import anything from the Kotlin build, unless you already know what those names will be. We also considered having some kind of templating system, which would dynamically replace names in the Swift code before compiling, but that idea went away a long time ago. I'd say add an issue as a feature request.
f

Filip Dolník

09/07/2023, 10:32 AM
One issue is that the Swift doesn’t know what the final Kotlin names will be until the compiler runs, so the hand-written Swift code can’t really import anything from the Kotlin build …
This is not a big problem even in the current public version. And 0.5.0 will improve the support.
Adding support for this functionality shouldn’t be very difficult for us because it’s technically already there - but only for the final Kotlin module. Adding it for other local modules should be easy. Adding it for 3rd party libraries is more involved but also possible. So definitely create a feature request in https://github.com/touchlab/SKIE/issues and we will considered it. And if there is enough demand I don’t see a reason to not add this feature.
j

Jon Bailey

09/16/2023, 1:37 AM
Would it be possible to import Swift only frameworks like combine or swiftUI? Either way being able to incorporate custom Swift code would be amazing
f

Filip Dolník

09/16/2023, 1:43 AM
Would it be possible to import Swift only frameworks like combine or swiftUI
That is possible (of course you would be able to use these frameworks only from the custom Swift code). However, I think that we currently support only the system frameworks and not 3rd party frameworks
2 Views