[swift-build-dev] SwiftPM Xcode Integration

Max Howell max.howell at apple.com
Fri Feb 19 11:55:00 CST 2016


One of our goals for the Swift Package Manager is excellent and delightful integration with Xcode.

To this end we are going to start work on initial integration by making SwiftPM able to generate Xcode project files. This is not the long-term design we want for the Xcode integration, but it is a concrete step we can take now which will allow Xcode users to adopt Swift packages and use them in their products. We expect this to significantly increase the adoption of SwiftPM and give us more feedback and experience, which will inform the eventual full integration design. This will also enable Swift packages to be built for Apple's iOS, Apple TV, and watchOS platforms, in addition to OS X.

The code for this will be written in the open as part of the SwiftPM open source project and we will begin the feature presently.

We would like to emphasize again that proper and tight integration with Xcode is our long-term goal, but in the near-term we consider this a good intermediary solution—making real Swift package use possible.

Our design for this feature is as follows:

* Generate a single xcodeproj from the command line for a Package.swift
* The xcodeproj will contain targets for all packages and their modules
* Require the user to add this xcodeproj to their main project and link the dependency by hand.

In addition to allowing users to adopt Swift packages in their Xcode projects through this mechanism, this will allow package authors to use Xcode to work on their packages.

We are also considering a feature that auto-regenerates the xcodeproj if the user changes their Package.swift or edits any of their package sources, though parts of that feature would be built in Xcode and not in the open source project. We are aware of the frustrating aspects of other systems that generate Xcode projects and will be looking at ways to mitigate the problems that come with this solution.

We're looking forward to your feedback on this intermediary solution as it evolves!

Max


More information about the swift-build-dev mailing list