I can create a new Swift Package in Xcode and able to add it in a workspace. This can be done using Xcode -> File -> New Package, add the name and select the workspace in "Add to" and select the folder in "Group". Then I can use this local package in another project within the same workspace.
Now I want to write a script that does the same thing. I learn about
swift package init
but this only creates the package and not sure how to add this to the workspace. Has anyone tried it?
#!/bin/bash
Variables
WORKSPACE_PATH="YourWorkspace.xcworkspace" PACKAGE_PATH="path/to/YourSwiftPackage" # Replace with the actual path to your Swift Package