Search code examples
iosswiftxcodexcode13docc

How to add String Extension on Apple DocC


I am checking new Apple documentation on Xcode 13 beta. I am able to build documentation with DocC.

But I am not able to see any documentation created for extensions like String extension, Date extension.

As per example for below case it will not add any documentation.

extension String {

    /// Description for DocC
    func myMethod() {
       
    }
}

Consider, If I have created an extension for any struct or class, then it is adding documentation like below code

public struct MyStruct {

}


extension MyStruct {

  /// Description
  func myMethod() {
 
  }
}

Is this default behaviour by apple or I am missing anything?


Solution

  • This is not currently supported. DocC cannot generate documentation for anything but a single module's types. Extensions to types outside your module aren't handled. (It also won't allow you to link to types outside your module using ``...`` references.)