Skip to content

Conversation

heckj
Copy link
Member

@heckj heckj commented Aug 19, 2025

Adds documentation for the Swift 6.1 traits feature

Motivation:

  • Show how to consume packages that provide traits
  • Show how to present traits from your package(s)
  • Updating PackageDescription API to use slightly more readable content related to traits.

Modifications:

  • updated PackageDescription API around traits
  • added curation (organization) for Traits and Package/Dependency/Traits
  • extended Using Dependencies article to touch on traits and how to consume packages that provide them
  • added an article to share patterns to use when providing a traits from your own package

Result:

Updated content and one additional article in the central documentation for Swift Package Manager that illustrates how to consume and provide packages with traits.

@heckj heckj self-assigned this Aug 20, 2025
@heckj
Copy link
Member Author

heckj commented Aug 20, 2025

@swift-ci please test

@heckj
Copy link
Member Author

heckj commented Aug 27, 2025

@swift-ci please test

Copy link
Contributor

@bripeticca bripeticca left a comment

Choose a reason for hiding this comment

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

This is looking wonderful! Just a few comments for you to check out :)

Copy link
Member

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

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

This is great. Thanks for working on this @heckj !

Within the package, traits express conditional compilation, and may be used to declare additional dependencies that are enabled when that trait is active.

Traits are identified by their names, which are name-spaced within the package that hosts them.
Copy link
Member

Choose a reason for hiding this comment

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

IIRC the latest is that traits use be valid Swift identifiers. We can link to the Swift book's grammar section on this.

Copy link
Member Author

@heckj heckj Aug 28, 2025

Choose a reason for hiding this comment

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

According to the SE docs, it's the identifiers with the addition of + and -, but I'll simplify this up. The SE proposal and internal docs were quite specific, so I reflected that here. Please take a look at the revised content and verify that it's accurate

@bkhouri
Copy link
Contributor

bkhouri commented Aug 28, 2025

@swift-ci test windows

@heckj heckj requested review from bripeticca and FranzBusch August 28, 2025 16:19
@bripeticca
Copy link
Contributor

@swift-ci please test

@bripeticca
Copy link
Contributor

@swift-ci please test windows

@bripeticca
Copy link
Contributor

@swift-ci please test macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants