Skip to content

Conversation

d-ronnqvist
Copy link
Contributor

@d-ronnqvist d-ronnqvist commented Jul 18, 2024

Bug/issue #, if applicable: rdar://131987745

Summary

This PR updates the documentation for the @Available directive to:

  • lead with information about when to use it and when to use in-source annotation instead
  • add documentation for the new "deprecated" parameter and mention which versions of DocC support it.
  • rephrases several sentences to avoid passive voice, for preferring "when you introduced this API" over "when this API was introduced".
  • Combine the 3 code examples into 1 and wraps it in a @Metadata directive so that it's clearer that @Available is used within @Metadata.

It also unhides and documents the @DeprecationSummary directive to:

  • provide information about when to use @DeprecationSummary and when to use in-source annotation instead
  • provide tips about using @DeprecationSummary and @Available together to give the reader the most information about a deprecated API.

Dependencies

None

Testing

Run swift run docc preview Sources/docc/DocCDocumentation.docc and preview:

Screenshot 2024-07-18 at 16 58 02 Screenshot 2024-07-18 at 16 58 07

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • [ ] Added tests Not applicable
  • Ran the ./bin/test script and it succeeded
  • Updated documentation if necessary

- Clarify when to use and not use this directive
- Add which versions support the deprecated parameter
- Rephrase sentences to avoid passive voice
- Combine all 3 examples into 1

rdar://131987745
Also, add tips about using @DeprecationSummary and @available together
@d-ronnqvist d-ronnqvist added the documentation Improvements or additions to documentation label Jul 18, 2024
@d-ronnqvist d-ronnqvist requested a review from anferbui July 18, 2024 14:59
Copy link
Contributor

@anferbui anferbui left a comment

Choose a reason for hiding this comment

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

LGTM!

This is very good to know, I didn't know we had to regenerate Sources/docc/DocCDocumentation.docc/DocC.symbols.json to update Swift-DocC's symbol documentation. Will keep that in mind for future PRs!

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

This is very good to know, I didn't know we had to regenerate Sources/docc/DocCDocumentation.docc/DocC.symbols.json to update Swift-DocC's symbol documentation.

Specifically for changes to directive documentation we need to know this.

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test Linux

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist
Copy link
Contributor Author

@swift-ci please test

@d-ronnqvist d-ronnqvist merged commit 8cddd57 into swiftlang:main Jul 26, 2024
@d-ronnqvist d-ronnqvist deleted the available-directive-docs branch July 26, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants