2009-07-07 24 views
6

Bir yöntemin kullanımını belgelemek için amaç-c sözdizimi nedir? Bu, .h veya .m dosyasında mı yapıldı?Yöntem 'dökü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) { 
... 
} 

bu # Pragma yönergesi ile yapılır mı: C# bir de

gibi bir şey kullanıyor?

sayesinde

Craig Buchanan

cevap

4

Objective-C yerleşik bir dokümantasyon özelliği yok. Apple, kaynak dosyalardan doküman oluşturabilen Headerdoc adında bir araç içerir, ancak several better options vardır. Bence en popüler olanı Doxygen, bu durumda sözdizimi Java tarzı /** Documentation here */. Nasıl kullanıldığına dair örnekler için Wikipedia page'a bakabilirsiniz (diğer dillerle de olsa). Apple'ın sitesinde instructions for using Doxygen with Xcode vardır.

20

Xcode 5'te yöntemlerinizi belgelemek için yeni bir yetenek var. Üstbilginiz dosyasında, bunları belgelerinde görünmesi için öylesine gibi fonksiyona yorum ekleyebilir:

/*! 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; 

Not ünlem ilk satırda.

Bu belge, Xcode'un sağ bölmesindeki Hızlı Yardım'da gösterilecek ve açıklama yazarken otomatik tamamlama işlevinde görünecektir.

+4

'/ **' ayrıca çalışır gibi görünüyor – davis