New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update README.md #72
Update README.md #72
Conversation
Update example Package.swift syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I had a couple comments about your changes.
@@ -11,13 +11,13 @@ The markup tree provided by this package is comprised of immutable/persistent, t | |||
In your `Package.swift` Swift Package Manager manifest, add the following dependency to your `dependencies` argument: | |||
|
|||
```swift | |||
.package(url: "https://github.com/apple/swift-markdown.git", .branch("main")), | |||
.package(url: "https://github.com/apple/swift-markdown.git", branch: "main"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a .package
method that has a branch:
parameter in the SwiftPM reference. Is this something that you needed to do to get this to build on your system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's there on the page you linked to :-)
Mostly I chose branch because that's what was there before, but there is a note on the pm reference that gives me pause:
/// Note that packages that use branch-based dependency requirements
/// can't be depended upon by packages that use version-based dependency
/// requirements; you should remove branch-based dependency requirements
/// before publishing a version of your package.
I don't know if the package manager really enforces that, it doesn't seem to, but we can't use version numbers here because the repo doesn't have semver numbered releases, just a lot of non semver tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't see it as an overload of the .package
method. Instead i see:
static func package(url: String, from version: Version) -> Package.Dependency
static func package(url: String, _ requirement: Package.Dependency.Requirement) -> Package.Dependency
static func package(url: String, _ range: Range<Version>) -> Package.Dependency
static func package(url: String, _ range: ClosedRange<Version>) -> Package.Dependency
static func package(path: String) -> Package.Dependency
The way to define a branch-based dependency is to use the .branch
method on Requirement
and the .package(url:_:)
overload that takes a Requirement
, like the existing readme states. Does the form you've added, .package(url:branch:)
work for you? I'm really curious to see if there's an undocumented overload there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's this one: https://developer.apple.com/documentation/packagedescription/package/dependency/package(url:branch:).
The .branch
version (https://developer.apple.com/documentation/packagedescription/package/dependency/requirement-swift.enum/branch(_:)) is deprecated as of Swift 5.6 but still works.
Co-authored-by: QuietMisdreavus <QuietMisdreavus@users.noreply.github.com>
Close in favor of #10 |
Update example Package.swift syntax