How to Remove a Swift Package Dependency in Xcode 11

How to Remove a Swift Package Dependency in Xcode 11

28 February 2025 Stephan Petzl Leave a comment Xcode

Xcode 11 introduced a streamlined process for managing Swift Package dependencies. However, removing a package dependency can sometimes be less intuitive. This guide outlines the steps to effectively remove a Swift Package Dependency from your Xcode project.

Step-by-Step Guide to Removing a Swift Package Dependency

  1. Open Xcode and select your project from the Project Navigator.
  2. Navigate to the top middle of the Xcode window and select the Swift Package Manager menu.
  3. Within this menu, you will find options to manage your packages. Here, you can add or remove package dependencies as needed.
  4. For a more direct approach, go to the Package Dependencies tab. Select the package you wish to remove and click the button to delete it.

Addressing Common Issues

Sometimes, even after removing a package, you might find that it reappears when you update to the latest package versions. This often happens if there are references to the package in other parts of the project configuration. Ensure that:

  • All references to the package are removed from the project.xcworkspace/xcshareddata/swiftpm/Package.resolved file.
  • Check the Frameworks, Libraries, and Embedded Content section under your target’s General settings tab and remove any remaining dependencies.
  • Review any sub-projects or nested dependencies that might reintroduce the package.

Optimizing Dependency Management

For projects with complex dependency structures, consider pruning unused dependencies to streamline build times and reduce your app’s memory footprint. This involves:

  • Deleting unnecessary dependencies from the Build Phases or Target General settings tab without deleting the package itself.
  • Ensuring that each target imports only the libraries it uses.

Enhancing Your Testing Workflow with Repeato

Efficient management of dependencies directly correlates with smoother testing processes. Repeato, our no-code test automation tool for iOS, Android, and web apps, provides a seamless way to create, run, and maintain automated tests. With its intuitive test recorder and fast execution, Repeato can help you ensure your app functions correctly, even as you manage and update your dependencies. Learn more about how Repeato can enhance your testing workflow in our advanced testing techniques documentation.

Like this article? there’s more where that came from!