How to add usage hints for our custom methods and properties in Xcode?

Code completion with usage hints at the bottom

In the attached image, Xcode shows usage tips (two lines at the bottom) for its classes. In the same way, is it possible to have my own tips for my own methods and class properties?

+6
source share
1 answer

You do this by adding specially formatted comments above the ad in your headline. ex:

/** * This is my awesome new property!!! */ @property (strong, nonatomic) NSObject *someProperty; /** * An even cooler description! * * @param string some string * @param arr some array */ - (void)myAwesomeMethodWithAweomseParamOfType:(NSString *)string andOtherParam:(NSArray *)arr; 

Then when I go to the implementation file and start typing ...

enter image description hereenter image description here

However, if you don't want to worry about how to format these comments, download the VVDocumneter from github. This is an Xcode plugin that will automatically add these comments. All you have to do is go to the line above the ad and press /// .

+10
source

Source: https://habr.com/ru/post/951720/


All Articles