Custom Quick Help documentation for Protocol method implementations?

I'm not sure if this is actually an Xcode issue or Swift.

Is there any way to override the default documentation that shows in Quick Help for my own implementation of a protocol method. It seems that Xcode always shows the generic Quick Help and not any custom documentation. The only way to see the custom docs is to go to the source file itself.

I'm seeing the documentation set on S.foo.

Did you mean something else?

No, but in my case I am using a protocol from stdlib, not one from my own code. Maybe that makes a difference?

    public struct UTF8LineIterator: IteratorProtocol {
        public typealias Element = Data

        public let data: Data
        private var byteIterator: Data.Iterator
        
        public init(data: Data) {
            self.data = data
            byteIterator = self.data.makeIterator()
        }
        /**
         Gets the next line of data up to and including the line end character.
         
         [A whole load of other info covering edge cases]

         - Returns: The next line's worth of data, or nil if there are no more lines. When non-nil, it is guaranteed that the result will not be empty
         */
        public mutating func next() -> Data? {
...
    }
}

Which version of Xcode are you using? Which version of Swift? Even with your code snippet, I'm still able to see the overridden documentation:


I'm using Xcode 12.4 (12D4e).

Xcode 12.4 and swift 5.3. Maybe I'm just unlucky here. The project I'm working on is quite complex (a fork of a large open source codebase) so maybe Xcode is getting confused.

Other functions in the same struct with Quick help are shown correctly, so I just assumed it was an Xcode limitation with protocols.