'generate-xcodeproj' is no longer needed and will be deprecated soon

Hello :wave:, When I use swift package generate-xcodeproj I get a warning:

warning: Xcode can open and build Swift Packages directly. 'generate-xcodeproj' is no longer needed and will be deprecated soon.

However, it is still needed. Without running the above command, Xcode is not smart enough to open it as an Xcode project, it looks like a normal package instead.

I don't understand this comment: Swift package generate-xcodeproj - #2 by lukasa

With Xcode 11 you can simply open a Swift package directly, without needing to generate an intermediary Xcode project. Navigate to your directory and type xed . .

Sure you can open with xed but that will get you the screenshot above, with no Xcode project tab e.g. (build settings, build phases, targets, etc.)

I'm afraid this functionality will be removed in the future, because I don't know what the error means. generate-xcodeproj seems useful to me.

Once I run swift package generate-xcodeproj, it's much better:

Could someone confirm my hunch? I have to pick the first screenshot (no Xcode project tab or .xcodeproj file at all) over the second?

Yup, I found The Xcode 11 and Swift Package Combo Platter quite useful :)

Correct. generate-xcodeproj is deprecated. Since deprecation, it has ceased to be updated to support new package features. It will eventually be removed entirely.

The current way to work with packages is to open the Package.swift file in Xcode.

None of these were ever actually supported by the package. If you tinkered with them, they only affected the Xcode targets, and not the underlying package. Thus, such settings had no effect on clients, even if you checked the project into source control alongside the package.

You can create custom schemes to use during development (which are stored in .swiftpm/xcode if you want to check them in). They can be used to control development toggles such as test coverage, location spoofing, or the command line arguments to feed to an executable when you click “run”.

Xcode‐style build settings and phases are prohibited precisely because packages do not support them. If you need them for a top‐level application or tool, then you should create an Xcode project for it instead. If it naturally belongs right alongside a library that is vended as a package, then you can still check it into the same repository. Drag the repository root directory into the Xcode project to reference the package with a relative path. From there you can link against any of the products from the package.


Thanks Jeremy, that's very helpful :)

Terms of Service

Privacy Policy

Cookie Policy