You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SymbolKit currently defines optional data fields for symbols and relationships as a set of "mixins", which is represented as a map from a "mixin key" to the parsed value of that mixin. Swift-DocC uses these mixins for various uses, but checking for a value and reading it out is a bit cumbersome. For example, this is how Swift-DocC loads availability information from a symbol:
if var availability = symbol.mixins[SymbolGraph.Symbol.Availability.mixinKey] as? SymbolGraph.Symbol.Availability
This could be greatly simplified into some kind of getMixin method on symbols and relationships in SymbolKit. It could look something like this:
Additional Detail from JIRA
md5: 9c3463d48a54fbd06e0e7b6bba7d89d2
Issue Description:
SymbolKit currently defines optional data fields for symbols and relationships as a set of "mixins", which is represented as a map from a "mixin key" to the parsed value of that mixin. Swift-DocC uses these mixins for various uses, but checking for a value and reading it out is a bit cumbersome. For example, this is how Swift-DocC loads availability information from a symbol:
if var availability = symbol.mixins[SymbolGraph.Symbol.Availability.mixinKey] as? SymbolGraph.Symbol.Availability
This could be greatly simplified into some kind of
getMixin
method on symbols and relationships in SymbolKit. It could look something like this:In fact, Swift-DocC already defines something similar, as an extension on mixin dictionaries themselves:
Adding one of these methods to SymbolKit and encouraging its use throughout Swift-DocC would make its codebase much more readable.
The text was updated successfully, but these errors were encountered: