Duplicate extensions in protocol implementations

Something that bothers me in the SwiftUI documentation is how all modifiers are duplicated across all implementations of the View protocol. This makes the documentation much larger than it could be. Is this something that DocC does by default and cannot be disabled or is it Apple's choice?

1 Like

DocC doesn't currently allow you to hide them, no. From a language standpoint, these modifiers are symbols that are synthesized from the compiler and distinct from their definition in the View protocol, which is why they're showing up as different symbols in documentation. However, since the original modifier method and its synthesized variants have the same documentation contents, I wonder if there's something we could do to help reduce the duplication from both archive size and user experience perspectives.

This makes the documentation much larger than it could be.

I'm interested in hearing more about this. Is this from the perspective of the produced DocC archive in terms of its size on disk, the number of results shown in the navigator filter, information displayed on a documentation page, or something else entirely?

1 Like

I think the number of results shown in the navigator filter is the main issue for me as a user. When a new Xcode beta is released, for example, I always like to compare with the previous one by selecting ADDED filter but the result is kind of noisy and hard to spot what is duplicated and what it is not.

2 Likes

This is especially egregious in Dash, where searching for any modifier returns results from every view. It would be really nice if these symbols weren't duplicated but were instead simply linked to the original declaration. Optionally we could see a section on, say, Text, which may show the modifiers inherited from View. I'd also like to see a similar treatment for actual inherited methods in class hierarchies. Navigating UIControl's API is a pain when so much of it comes from underlying classes. It seems like the presentation of this info would be similar in the protocol and class cases.

4 Likes