Xcode 14.0.1 running on macOS Monterey 12.6.
I have a class MeetingDirectory
that defines two subscript functions:
public subscript(_ date: String) -> ValueOrMessage<Meeting> { ... }
public subscript(_ date: String, visit: CaseID) -> ValueOrMessage<Meeting> { ... }
In my DocC extension file for this class, I want to generate links to the documentation for both subscripts.
Problem 1: I type two backticks and Xcode offers autocompletions for all the class's public functions, including two subscript functions; but the subscript functions are each presented in the autocomplete list as just subscript
with no additional information — there is no way to differentiate them.
Problem 2: By trial-and-error, I find that one subscript
expands into subscript(_:)
and the other one expands into subscript(_:visit:)
, as I would have expected. So my topics list looks like:
### Getting a Specific Meeting
- ``subscript(_:)``
- ``subscript(_:visit:)``
But when I compile the documentation, the subscript(_:visit:)
line gets this warning: “Topic reference 'subscript(_%3Avisit%3A)' couldn't be resolved. No local documentation matches this reference.” and subscript(_:visit:)
doesn't show up in the “Getting a Specific Meeting” topic section. Instead, it shows up in the default “Subscripts” section, with the signature
subscript(String, CaseID) -> ValueOrMessage<Meeting>
and if you click on the link, the title on the function documentation page has the signature subscript(_:_:)
(although the “Declaration” and “Parameters” sections on the function documentation page are correct).
Problem 3: So I tried writing the symbol reference as subscript(_:_:)
instead. Now the documentation compiles without errors, and both subscript functions show up under “Getting a Specific Meeting”, but, as you might expect, it still shows up with the (_:_:)
signature.