Manually replicate what swift package generate xcodeproj did

Because of a wrapper on swift that I have to use I cannot directly use SPM to import packges.

I have to create*.xcodeproj for the project I am importing and I cannot use swift package generate xcodeproj anymore because it has been deprecated.

I even tried using an older version of swift to run the generate command, but it fails with all sort of errors.

Is there a way to manually do what swift package generate xcodeproj did? If so, what would it be?

Honestly you're better off updating/changing/removing whatever wrapper you're using that means you can't use SwiftPM directly. It's the future, is only going to get more ingrained as macros and build plugins mature so you'll need to do it eventually


I guess you could look through the code that SwiftPM used for the generate-xcodeproj command and try to replicate it externally. The pull request that removed the feature looks like a good starting point for finding the relevant code: Remove `generate-xcodeproj` command by neonichu · Pull Request #5748 · apple/swift-package-manager · GitHub

Perhaps you could even extract this code into a SwiftPM command plugin and bring the feature "back" into SwiftPM that way. (To be clear, this is just an idea. I haven't investigated this and I don't know if it's possible. It may well be that the command plugin API doesn't provide plugins with enough information to replicate what the built-in command did.)

1 Like

100% agree. And it is in the works, but it is not trivial so it will take time. I was looking for a patch in the meantime

Thanks, I will look at the source code!

1 Like