I asked Claude to update PeopleInSpace sample to u...
# swift-export
j
I asked Claude to update PeopleInSpace sample to use Swift Export instead of SKIE.....it got pretty far but ran in to some issues. More details in github.com/joreilly/PeopleInSpace/pull/524. I'll keep digging...
πŸ‘€ 2
kodee surprised 1
ok, result of further investigation in comments in that PR....seems to be issue with probably known issues around use of generics
trying to limit what's exposed to see if it makes a difference
s
FWIW I did a similar exercise and found this to be the ultimate blocker. Everything else could be worked around. https://youtrack.jetbrains.com/issue/KT-85981/Swift-Export-generic-property-with-specified-type-generates-uncompilable-bridges With ObjC export all generics were treated as id, relaxing constraints at the boundary but allowing upcast at runtime. With Swift Export it's all compile time so couldn't find a way around πŸ™
πŸ‘ 3
πŸ‘πŸΎ 1
j
some progress with Kotlin 2.5.0-Beta1....this is summary from Claude
Copy code
Fixed in 2.5.0-Beta1:
- ViewModel vtable crash: gone. Kotlin compiles and Swift Export generates the Swift code.
- Duplicate @_spi stubs from kotlinx-serialization (KT-87791): fixed. I disabled the build-file workaround and the only errors left came from the Koin duplicates below. I cut the workaround down to that one part.

Still broken:
- Koin Module.module() stubs: still emitted as duplicate unavailable declarations (3 Γ— invalid redeclaration of 'module'), so the reduced workaround stays.
- Runtime crash on the ISS Position tab: passing the Swift factory into Kotlin throws ClassCastException: iOSNativeViewFactory cannot be cast to dev.johnoreilly.common.ui.NativeViewFactory. Changing the parameter to the class type fails the same way, so the Kotlin object behind a Swift subclass doesn't know its Kotlin supertypes. The 2.5.0-Beta1 changelog lists KT-88042, a ClassCastException when Kotlin calls an interface method on a Swift subclass, as fixed. This case isn't covered by that fix, and it's the new blocker;
also btw get different issues if I switch to new swiftexport build config
Copy code
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                  β”‚ swiftExport { }  β”‚                          export { swift { } }                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Kotlin modules exported to Swift β”‚ 7                β”‚ 13 (adds Kermit, Stately, Koin annotations, Koin ViewModel, SavedState) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Generated Swift                  β”‚ about 6.7k lines β”‚ about 29k lines                                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Xcode build                      β”‚ succeeds         β”‚ fails                                                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The failures are in generated code that the old DSL never produced. In the generated stdlib, an unqualified Int(...) now resolves to the exported <http://kotlin.Int|kotlin.Int>, and the ViewModel module has subscript override errors. The new DSL only offers moduleName, rootPackage and xcodeIntegration(), so there's no way to narrow what it exports.
a
Hello there πŸ™‚ Thanks for the report! I'm happy to report that we have fixed everything in this thread for
Beta2
. It should be already be merged as of yesterday, and I hope that earliest Beta2 builds would become available this week. Thanks again for the report, we have missed those bugs and are very happy to fix them πŸ™‚
πŸ‘ 1
Well, everything, exccept for youtrack.jetbrains.com/issue/KT-85981/Swift-Export-generic-property-with-specified-type-generates-uncompilable-bridges - this will require the whole implementation of Generics support πŸ™‚
>
Copy code
The new DSL only offers moduleName, rootPackage and xcodeIntegration(), so there's no way to narrow what it exports
That's actually was a half backed feature in Beta1, and in Beta2 one would be able to hide a dependency fully from the export like this
Copy code
xcodeIntegration{
        configure(projects.subproject) {
        visibility = SwiftExportVisibility.HIDDEN
        moduleName = "Subproject"
        rootPackage = "com.github.jetbrains.library"
    }
}
And for Full or Transitive export we now rely on api/implementation info on the exported module, so no more duplication of dependencies between dependency block and export block πŸ™‚
j
@Artem Olkov tried Beta2 dev build and looking very good. Following branch updated (and PR comment added with findings....thanks to Claude πŸ˜ƒ ) github.com/joreilly/PeopleInSpace/pull/524
this branch is also based on having a new
ios-export
module....I asked Claude to see if we could go back to consuming
common
from iOS and ran in to a few issues (it added comments for what it tried to PR in case useful)
in general if there are any things you think should be changed in the project when using Swift Export then of course am very happy to incorporate
also wrote small article on changes made....again if anything doesn't look right I can update johnoreilly.dev/posts/peopleinspace-swift-export
a
also wrote small article on changes made....again if anything doesn't look right I can update johnoreilly.dev/posts/peopleinspace-swift-export
Oh that's great! I will ping you with some links with official docs and other stuff as soon as we are ready with them, so that you can update the article, if that alright with you πŸ™‚ This will happen somewhere close to the actual release of 2.5.0
this branch is also based on having a new
ios-export
module....I asked Claude to see if we could go back to consuming
common
from iOS and ran in to a few issues (it added comments for what it tried to PR in case useful)
Yeah, I've tried to read all the comments in that PR, but it's a lot of words, I will have another go at it after my vacation πŸ™‚ One thing that stand out - your Claude (at least in the first comments there) is unaware of the fact that it can
@HiddenFromObjectiveC
any user defined declaration to hide it. I saw a lot of complaint that it cannot mark something as internal, because it's needed for other targets.
Oh and by the way thanks A LOT for your article with benchmark of Swift Export. Because of that we have already found and fixed a quirk of our kotlin code generation, reducing compilation of kotlin bridges almost by 2.5 times(that is already in the Beta2 branch), and we are working on improving the caching altogether. I cannot promise we will be able to cherry pick other improvements to the 2.5.0 release, but even if not - 2.5.20 will be much faster thanks to you and your work.
❀️ 2
πŸ‘ 1
j
Nice!