I'm sure you were just dying to see a bit of a raw symbol graph in the forums, so - taking from Ole's example, this is the function signature that's generated by a symbol graph for the doSomething
method, which is - if it existed, I thought I might find the Sendable
detail about the parameter.
"functionSignature": {
"parameters": [
{
"name": "body",
"declarationFragments": [
{
"kind": "identifier",
"spelling": "body"
},
{
"kind": "text",
"spelling": ": () -> "
},
{
"kind": "typeIdentifier",
"spelling": "Void",
"preciseIdentifier": "s:s4Voida"
}
]
}
],
"returns": [
{
"kind": "text",
"spelling": "()"
}
]
},
(I used the command swift package dump-symbol-graph
to get the detail, and took a snippet of the resulting file)
I made another quick variation that included @escaping
in a similar method, and it also doesn't show in the parameters list, but it does get listed with the list of declarationFragments
. For the Ole's original example, that output today is:
"declarationFragments": [
{
"kind": "keyword",
"spelling": "func"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "identifier",
"spelling": "doSomething"
},
{
"kind": "text",
"spelling": "("
},
{
"kind": "externalParam",
"spelling": "_"
},
{
"kind": "text",
"spelling": " "
},
{
"kind": "internalParam",
"spelling": "body"
},
{
"kind": "text",
"spelling": ": () -> "
},
{
"kind": "typeIdentifier",
"spelling": "Void",
"preciseIdentifier": "s:s4Voida"
},
{
"kind": "text",
"spelling": ")"
}
],
So I think the fundamental issue is that Sendable isn't included in that list as an attribute.
Instead of the following entry from the above list:
{
"kind": "text",
"spelling": ": () -> "
},
I'd think to see something like:
{
"kind": "text",
"spelling": ": "
},
{
"kind": "attribute",
"spelling": "@Sendable "
},
{
"kind": "text",
"spelling": "() -> "
},
Which I think would reflect the @Sendable attribute into the resulting documentation content.
/cc @QuietMisdreavus, who's far more familiar with symbol graphs than I.
In short, it looks like the SymbolGraph returned from the compiler isn't providing the detail needed to expose it in DocC at the moment.