How can I show C++ code documentation in Xcode 9.3?

放肆的年华 提交于 2019-12-01 04:19:02

You cannot. According to Apple's Xcode release notes, as of Xcode 8.3

3rd party docset support is now deprecated and will no longer be supported in a future release of Xcode. (30584489)

There are alternate doc browsers, like Dash which allow you to install your own documentation. But this does not give you what you're hoping for.

I have verified that adding a C++.docset into ~/Library/Developer/Shared/Documentation does not work. (likely a directory left over from an earlier Xcode) In fact, removing this directory entirely does not affect Xcode 9.x from correctly displaying the default documentation.

This is for your custom class. You can add your comment like this - in the header I do this

 /**
     * Method name: name
     * Description: returns name
     * Parameters: none
     */

here is a sample I did -

#ifndef test_hpp
#define test_hpp

#include <iostream>
#include <string>

class myclass{
private:
    std::string name_;

public:

    myclass(std::string);
    /**
     * Method name: name
     * Description: returns name
     * Parameters: none
     */
    std::string name();
};

#endif /* test_hpp */

I'll upvote Deb's answer but I was also looking at this for a little while.

Markdown in Xcode is somewhat brittle in Xcode 9.

It works for function declarations:

And also for callouts:

Documentation comments seems to work well for function declarations, but doesn't work at all for lines of code within the functions.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!