When using Swift Package Manager how can I generate an Xcode project file for development

Avner Barr picture Avner Barr · Dec 6, 2015 · Viewed 11.1k times · Source

I am using the new open source Swift Package Manager and am able to download the files. I want the manager to create a "development environment" (Through Xcode) based on the packages it retrieved.

Has anybody dealt with this?

Answer

Kostiantyn Koval picture Kostiantyn Koval · Dec 9, 2015

Update: as mentioned in other answers, you can now generate Xcode project files with this command:

swift package generate-xcodeproj

Original answer:

The Swift Package Manger (SPM) is cross platform, It works on Mac and Linux. The Xcode is Mac OS only, so I don't think SPM will be hard integrate to work with Xcode.

SPM can do 2 things:

  • Build swift source code into modules (Executable and Library)
  • Fetch dependencies (from git or local path)

The SPM work only with Source code, folders and files. It doesn't know anything about Xcode.
Also it is mentioned that in the future Apple plans to add support for other languages not only Swift and Objc.

My answer: SPM will not ingrate with Xcode. But because it's open-source anyone can just make its own fork and add custom feature that would generate Xcode specific files.