Reputation: 10136
Is there a way to define dependency in Package.swift
that would point at a certain branch latest commit, or even to just a specific commit ID (just like it is possible with Carthage)?
Use case would be, let's say I have a library repo where I would like to branch out and make some changes, and then be able to test them out in a dependent project.
Upvotes: 20
Views: 12215
Reputation: 403
It is possible.
Upvotes: 7
Reputation: 3595
As of Swift 4 you can use .branch()
and .revision()
as described in PackageDescription.md.
Upvotes: 11
Reputation: 8483
Not yet, but swiftpm team is working on. Now you must specify a package version when declaring a dependency.
import PackageDescription
let package = Package(
name: "Example",
dependencies: [
.Package(url: "https://github.com/somePackage", "1.0.0")
]
)
In the future it will be possible, there was a discussion to add Version Locking but its not accepted and implemented yet.
For your use case you can fork the repo, do the changes, test them and then add a version tag to your fork. Now it's much more easier to do changes with Editable Packages functionality.
Upvotes: 1