Convert Objective-C SPM Package to Swift

I have a SPM Package that is currently written entirely in Objective-C. We are wanting to start migrating it to Swift. However, SPM Packages don't allow for mixed languages in a single target. Many others have suggested to just make a different target for the Swift code and the Objective-C code. Which at first glance, sounds doable. However, many files depend on each other within this package. And with this format files in one target can not depend on a file in another target.

This means we'd have to do mass migration to Swift as opposed to converting 1 file/class at a time.

Are there any workarounds to this behavior? Or is this something that the Swift team plans to address in the future?

1 Like

If Apple was to come up with a Obj-C → Swift converter, it would not only benefit a lot of developers still stuck with (large portions
of) ObjC, but the quality of code translated into Swift may potentially be a lot better than 3rd party solutions. Swift already inter-ops with Obj-C so well, and Swift engineers are probably in a better position to write such a conversion tool.

There's still large amount of code out there in Obj-C, a lot in our case for instance, that I'd like to convert to Swift one day - hopefully not one line at a time.