Link to a symbol in parent class

Have a question regarding how DocC behaves in class inheritance. In the example I have some dummy classes: Geometry, Feature, and SubFeature. SubFeature inherits from Feature.

I want to reference SubFeature.geometry property in the API doc. However, it seems the ``SubFeature/geometry`` DocC symbol link doesn't resolve. Only the ``Feature/geometry`` link resolves. (in the real usecase I'm referencing to the SubFeature subclass from a different type's API doc.)

Is this expected that symbol link only resolves on base class, not subclasses? Thanks.

import Foundation

/// A dummy class that represents a geometry.
public class Geometry {
    let id = UUID()
}

/// A dummy class that represents a feature that has a geospatial ``Geometry``.
public class Feature {
    public let geometry = Geometry()
}

/// A dummy class that represents a sub feature. It should have access to the
/// geometry of its parent feature,
/// i.e., ``SubFeature/geometry`` (link doesn't work).
/// i.e., ``Feature/geometry`` (link works).
public class SubFeature: Feature {
    public let someMethod: () -> Void = {}
}

You can't link to SubFeature/geometry because there's no SubFeature-specific geometry page. If SubFeature were to override the geometry property, then a SubFeature/geometry page would be created and the link would resolve.

It is interesting, however, to consider whether SubFeature/geometry could/should resolve using the inheritance chain...

1 Like