Sample Project - Relative local repositoryURL

Hello!

I'd like to include little sample projects for my Swift Packages in the same repo as the package and I was wondering if relative local file paths are supported with the repositoryURL parameter. The Xcode UI doesn't seem to like them (file://../).

Cheers,
Stephen

You can drag and drop the package directory into the project.

1 Like

Brilliant, thanks!

I also noticed that if I update a dependency version in the "drag and dropped" instance of the swift package that it doesn't pull the updated version.

dependencies: [
         .package(url: "https://github.com/daltoniam/Starscream.git", from: "3.0.6" /* Update to 3.1.0 */)
    ],

Is a commit required for that to happen?

Cheers,
Stephen

Xcode should automatically update the dependencies unless the previously resolved version of Starscream already satisfied from: 3.1.0 (or maybe it failed to detect the change, in that case you can manually trigger a resolution File -> Swift Packages -> Resolve Package Versions).

Ah, I see the issue. 3.1.0 satisfies the .from("3.0.6") requirement because it's within the "up to next major version". Changing it to ._exactItem("3.0.6") exhibits the behavior I was curious about.

Thanks again Aciid!

Just a minor note: _exactItem is an internal API, please use the public one instead:

.package(url: "https://github.com/daltoniam/Starscream.git", .exact("3.0.6"))