Member-only story
Documentation Markup in iOS(XCode)
3 min readOct 2, 2020
Class documentation
Here is a basic class documentation example:
/// Class descriptionclass Student {
// Member descriptionvar name: String/// Method description
///
/// - parameter content:
///parameter description/// - returns: return value descriptionfunc say(content: String) -> Bool {
print("\(self.name) say \(content)")
return true }
}
Note that with Xcode 8, you can generate the documentation snippet with command + option + / .
This will return:
Documentation styles
/**
Adds user to the list of poople which are assigned the tasks.- Parameter name: The name to add- Returns: A boolean value (true/false) to tell if user is added successfully to the people list. */func addMeToList(name: String) -> Bool {
// Do something....return true}
/**
Repeats a string `times` times- Parameter str: The string to repeat. - Parameter times: The number of times to repeat `str`- Throws: `MyError.InvalidTimes` if the `times` parameter
is less than zero