Is it expected that only things directly under `ro...
# swift-export
j
Is it expected that only things directly under
rootPackage
get an alias in Swift? With root package
com.example
, classes like
com.example.domain.model.User
get no alias, whereas
com.example.User
does become just
User
in Swift. Unless I add anything in
com.example.domain
in [iosMain]. So now I have a dummy
public object SwiftExportPackageMarker
there (Still on 2.5.0-Beta2 because of Koin Compiler not working with RC yet)
❤️ 2
r
Hey! Yes this is expected. We actually have a ticket for this: https://youtrack.jetbrains.com/issue/KT-88467/Swift-Export-Allow-multiple-or-all-packages-to-be-flattened Would also love to hear your use case and expectations for this topic.
j
Thanks! Regarding my use case I’m actually thinking if this may be intentional. It seems on iOS/Swift, it’s more common to have a flatter structure instead of our package-based structure. Need to dive into this more. Is that what you mean with “_disable the package/enum generation completely_” in that ticket? Having packages on the Kotlin-side but iOS just doing one import and then having everything available? Or with “_multiple root packages_”?
r
Yeah Swift normally doesn’t have packages, however in Kotlin we do and declarations inside different packages might conflict if we were to export them without packages. That’s basically why the packages are exported to Swift, to prevent conflicts. The ticket indeed describes two options: 1. allowing you to specify multiple root packages (e.g.
com.example.foo
and
com.example.bar
, but not
com.example.baz
). 2. an option to completely disable the packages on the Swift side (so all declarations are exported to the root)
thank you color 1
z
ran into this recently too and upvoted that ticket 🙂 I get why, but would love to control it myself
d
ObjectiveC Export puts everything into root, so it would be nice to have the same feature in Swift Export with opt in