Skip to content

Allow documentation to reference Swift stdlib symbols #419

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

Open
ktoso opened this issue Nov 8, 2022 · 5 comments
Open

Allow documentation to reference Swift stdlib symbols #419

ktoso opened this issue Nov 8, 2022 · 5 comments
Labels
new feature New features or new functionality

Comments

@ktoso
Copy link

ktoso commented Nov 8, 2022

Feature Name

Reference Swift stdlib symbols

Description

This is related to Allow combined documentation of multiple targets #255 but specific about libraries shipped with Swift.
This includes libraries such as Swift, _Concurrency and Distributed and there is increasingly more of those -- like regex builders etc.

Those modules are "well known" and it should be possible, unless some dependency "shadows" it, to refer to e.g. Concurrency/Task and that link should direct to a well known place where those docs for stdlib are -- likely on apple.com etc.

Motivation

As we develop more concurrency, and distributed actor libraries, a lot of them are refering to Task and other types declared in Swift, but our library docs cannot point developers to their documentation efficiently.

Importance

Important for a cohesive developer experience using Apple (and non-apple) developed libraries.

Alternatives Considered

No response

@ktoso ktoso added the enhancement Improvements or enhancements to existing functionality label Nov 8, 2022
@d-ronnqvist
Copy link
Contributor

To try and set expectations:

I view linking to Swift standard library symbols as the same problem as the "Linking to symbols in SDKs and other pre-built dependencies." future diction that's mentioned in the "Combined documentation of multiple targets" forum post.

What that means for this issue is that we view it as an important enhancement but we'll want to deliver the core support for combined documentation of multiple targets before making any serious progress on this.

@ktoso
Copy link
Author

ktoso commented Nov 9, 2022

Yeah that's fine, the multiple-targets is the most important thing; I was talking with @franklinsch yesterday about features and this came up so I promised to file issues :)

@d-ronnqvist d-ronnqvist added new feature New features or new functionality and removed enhancement Improvements or enhancements to existing functionality labels Dec 21, 2023
@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Jan 11, 2024

Hi @ktoso . A current workaround in my experience is to manually use hardcoded link in you documentation.

- <doc://com.apple.documentation/documentation/Swift/AsyncSequence> // Apple
- <doc://com.apple.documentation/documentation/Swift/Never> // Apple
+ [AsyncSequence](https://developer.apple.com/documentation/Swift/AsyncSequence) // Other package
+ [Never](https://developer.apple.com/documentation/Swift/Never) // Other package

I assume when Apple is releasing their SDK, they may use some trick such as external-resolver so that they can reference AsyncSequence as <doc://com.apple.documentation/documentation/Swift/AsyncSequence> directly in their SDK's Swift file.

image

But currently for our 3rd party developer, we can manually use such link([AsyncSequence](https://developer.apple.com/documentation/Swift/AsyncSequence)) as a workaround to provide the same experience as Apple.

  • Go to Apple's documentation site when viewing on web
  • Go to corresponding doc page when viewing in Xcode docuemntation
image

@ktoso
Copy link
Author

ktoso commented Jan 11, 2024

Sure, hardcoding is a workaround; this is a feature request to support this properly.

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Jan 11, 2024

I'm expecting we public the external-resolver thing of Apple is using internally as a public tool. So that we can achieve the feature by using

https://github.com/apple/swift-docc/blob/main/Sources/SwiftDocC/Infrastructure/External%20Data/ExternalSymbolResolver.swift

docc ... \
	-external-resolver /path/to/apple-doc-resolver

The apple-doc-resolver will receive request from external bundle com.apple.documentation and respond them as https://developer.apple.com/documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New features or new functionality
Projects
None yet
Development

No branches or pull requests

3 participants