I'm documenting the code for my company's iOS application, and now I've moved on to methods that have a completion handler. Is there a specific method for documenting completion handlers, or should I just put it as part of the parameters?
for example:
/**
Description
- Parameters:
- parameter1: description
- parameter2: description
- completion: description
*/
Is this the right way or is there another better way? Or maybe it should be in the "Returns" part of the documentation?
Thanks
Since the previous accepted answer failed to compile under Swift 3 (Function types cannot have argument label.) I would like to add an updated answer:
/**
Find User ID from Request
- Parameter from: The request containing relevant information.
- Parameter completionHandler: The callback called after retrieval.
- Parameter userId: The retrieved user id.
*/
static func extractUserId(from: RouterRequest, completionHandler: (_ userId: String) -> Void)
Looks good enough for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With