问题
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?
回答1:
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.
回答2:
As of PR #174 on the swift-package-manager project, there exists an option for generating an Xcode project file in root directory of the package:
$ swift package generate-xcodeproj
Note: Earlier builds used:
$ swift build --generate-xcodeproj
It will officially be part of Swift's 3.0 release.
But it is already available with Xcode Swift DEVELOPMENT Snapshot 2016-03-24 or later!
回答3:
I wrote a small command line tool for that
it's called spawn
: https://github.com/vinhnx/spawn
Basically, it's just a small combination of repetitive commands when you want to try out a SPM package:
$ swift package update # update or resolve package dependencies
$ swift package generate-xcodeproj # generate a .xcodeproj to edit on Xcode
$ xed . # open generated .xcodeproj automatically
来源:https://stackoverflow.com/questions/34116041/when-using-swift-package-manager-how-can-i-generate-an-xcode-project-file-for-de