Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 is showing usage hints (two lines at the bottom) for its classes. Similarly, is that possible to have my own hints for my custom class methods and properties?

like image 380
Saran Avatar asked Aug 14 '13 13:08

Saran


1 Answers

You do this by adding a specifically formatted comments above the declaration in your header. e.x:

/**
 *  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 head over to my implementation file and start typing...

enter image description hereenter image description here

However, if you don't want to bother remembering all the specifics of how to format these comments, download VVDocumneter from github. It's a Xcode plugin that will automatically add these comments. All you have to do is navigate to the line above the declaration, and hit ///.

like image 103
Mick MacCallum Avatar answered Sep 23 '22 02:09

Mick MacCallum