Skip to content

Update README.md #72

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ 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"),
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

```

Add the dependency to any targets you've declared in your manifest:

```swift
.target(name: "MyTarget", dependencies: ["Markdown"]),
.target(name: "MyTarget", dependencies: [
.product(name: "Markdown", package: "swift-markdown"),
]),
```

To parse a document, use `Document(parsing:)`, supplying a `String` or `URL`:
Expand Down