2009-07-07 18 views
6

विधि के उपयोग को दस्तावेज करने के लिए उद्देश्य-सी वाक्यविन्यास क्या है? क्या यह .h या .m फ़ाइल में किया गया है?विधि 'दस्तावेज'

सी # एक में उपयोग करता है की तरह कुछ:

/// <summary> 
/// Executes an HTTP GET command and retrieves the information.  
/// </summary> 
/// <param name="url">The URL to perform the GET operation</param> 
/// <param name="userName">The username to use with the request</param> 
/// <param name="password">The password to use with the request</param> 
/// <returns>The response of the request, or null if we got 404 or nothing.</returns> 
protected string ExecuteGetCommand(string url, string userName, string password) { 
... 
} 

इस #pragma निर्देश के साथ किया है?

धन्यवाद,

क्रेग बुकानन

उत्तर

4

ऑब्जेक्टिव-सी एक अंतर्निहित प्रलेखन सुविधा नहीं है। ऐप्पल में हेडरडोक नामक एक टूल शामिल है जो स्रोत फ़ाइलों से दस्तावेज़ उत्पन्न कर सकता है, लेकिन several better options हैं। मुझे लगता है कि सबसे लोकप्रिय Doxygen है, इस मामले में वाक्यविन्यास जावा-शैली /** Documentation here */ है। उदाहरण के लिए आप Wikipedia page देख सकते हैं कि यह कैसे उपयोग किया जाता है (हालांकि अन्य भाषाओं के साथ)। ऐप्पल की साइट पर instructions for using Doxygen with Xcode है।

20

आपकी विधियों को दस्तावेज करने के लिए एक्सकोड 5 में एक नई क्षमता है। पहली पंक्ति पर

/*! Executes an HTTP GET command and retrieves the information. 
* \param url The URL to perform the GET operation 
* \param userName The username to use with the request 
* \param password The password to use with the request 
* \returns The response of the request, or null if we got 404 or nothing 
*/ 
- (NSString *)executeGetCommandWithURL:(NSURL *)url userName:(NSString *)aUserName andPassword:(NSString *)aPassword; 

नोट विस्मयादिबोधक बिंदु: अपने हेडर फाइल में, आप टिप्पणी अपने कार्य करने के लिए तो जैसे उन्हें प्रलेखन में दिखाई बनाने के लिए जोड़ सकते हैं।

यह दस्तावेज़ Xcode के दाएं फलक में त्वरित सहायता में दिखाई देगा, और जब आप टाइप करते हैं तो विवरण फ़ंक्शन ऑटो-पूर्णता में दिखाई देगा।

+4

'/ **' काम भी लगता है – davis

संबंधित मुद्दे