[swift-users] Xcode Integration with Swift Package Manager (Almost there!)

Daniel Opdyke danopdyke at gmail.com
Wed Oct 19 11:28:13 CDT 2016

Hey all,

I apologize if this has already been sent via the mailing list. I’ve been
researching this issues for a few days now, and am having a bit of trouble
understanding how to best integrate XCode projects with the Swift Package
Manager. I’m hoping that, if we’re able to find a solution, I can post this
somewhere for others who may be running into the same issue. For reference,
I’ve tried the solutions provided the following sites.




I essentially have two projects: The first is a library with a third-party
dependency (Alamofire), and the second is an iOS application. After setting
up the Package.swift file for the library, I’ve run the “swift package
generate-xcodeproj” command, which has created an xcode project. I’ve
verified that this project builds correctly. The project has been checked
into a Git repo.

I then created a Package.swift file for the iOS app, and set the library
project as a dependency. When I run the “swift package fetch” command, it
pulls both the library project, as well as the Alamofire project, into my
Packages folder. However, if I attempt to bring the library project’s
xcodeproj into my iOS app’s workspace, I get compiler errors. It seems like
the library project is expecting the Alamofire source to be within the
Packages*, as opposed to the iOS app’s Packages.

To visualize

+ iOS App

   + Packages

      + MyLib

         + Packages

            + Alamofire (folder without any source)

      + Alamofire

As a workaround, I’m able to navigate into the “MyLib” folder, and run
“swift package fetch”. This fetches the Alamofire source into the inner
Packages folder, but also results in the project having two version of the

I’m guessing that this dependency flattening is intentional, and that my
problem is likely due to my misunderstanding of the intended workflow.

Thank you in advance for any help. I promise to return the favor ;).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161019/ed795a7a/attachment.html>

More information about the swift-users mailing list