Swift Package with Demo project with Xcode 16

My current workflow to have a Swift Package with a Demo is like this:

PackageFolder > DemoFolder

I have a package, with a Demo folder inside. I can open the Demo project and Drag&Drop the local PackageFolder to override the remote dependency with the local one. This allows to edit the package while inside the demo project.

With Xcode 16 this does no longer work because Xcode does not allow to drop an ancestor of the file path where the project is located. Xcode does not tell this while you drop, it just does not allow it. But it tells you thats the reason, when you try to add the local package as a dependency to the project: "The selected package cannot be a direct ancestor of the project.".

(Dropping other local packages still works, see: https://forums.developer.apple.com/forums/thread/756824)

What is the expected way to handle a package with a demo project with Xcode 16?

Answered by simonnickel in 800341022

At least with Xcode 16 beta 5 it is possible to add the package as a local dependency to the demo project.

The following steps give me the result I need: Open Project > Package Dependencies > Add package > "Add local"

Optional for more convenience: Add package as reference: Drag&Drop folder of target from the package into Xcode 1. Action: Reference files in place 2. De-select target

Created FB14138815 for this issue.

I have the same problem and question. Would love an answer from Apple on this.

same on 15.4

Accepted Answer

At least with Xcode 16 beta 5 it is possible to add the package as a local dependency to the demo project.

The following steps give me the result I need: Open Project > Package Dependencies > Add package > "Add local"

Optional for more convenience: Add package as reference: Drag&Drop folder of target from the package into Xcode 1. Action: Reference files in place 2. De-select target

It is still not working in my environment.

  • Xcode 16.1 Betas 2
  • Xcode 16.0
  • Xcode 16.0 Betas 5

Is drag and drop not possible in Xcode versions prior to 15?

Swift Package with Demo project with Xcode 16
 
 
Q