Search code examples
iosxcodecarthagezipfoundation

Importing ZipFoundation in Xcode using Carthage not working


I followed all the steps to import Zipfoundation in my project using Carthage but it doesn't work. I can import Alamofire without issues using Carthage so I am guessing the first steps are right.

Zipfoundation imports into the folder without issues. The main difference is that ZipFoundation mentions that the fetched project has to be integrated into your workspace by dragging ZIPFoundation.xcodeproj to Xcode's Project Navigator.

enter image description here

I dragged it in my project and nothing happened. So I drag the frameworks and added the information to the build phases like I did with Alamofire but still nothing.

when I type "Import Alamofire" Alamofire shows up but nothing for "Import ZIPFoundation"

Is there a step I am missing?

enter image description here

enter image description here


Solution

  • Adding dependencies as .xcodeproj can be a bit cumbersome because Xcode has the tendency to move the dragged-in file under an existing project.
    But to add a dependency to a workspace, the dragged in project should be a sibling and not a child of the consuming project.

    3 Things are important for that to work:

    • Your project must be part of an Xcode Workspace (it can be a workspace that for now only contains one single project)
    • ZIP Foundation has to be checked out via carthage update --no-build
    • The project must be on the same level as the consuming project in the workspace:

    enter image description here

    You also don't need the "Copy Frameworks" script for ZIP Foundation when you integrate it with the method described above. The Carthage Build folder won't contain a binary framework when you use the --no-build option.
    Just make sure that ZIPFoundation.framework is in the "Embedded Binaries" list of your target.