课程来自慕课网liuyubobobo老师
文档注释
- 注释基础和Mark Down
/**
Role:游戏角色
被子类User继承
+ name:角色名
+ group:组织名
*/
class Role {
var name: String
var group: String
init(name: String, group: String) {
self.name = name
self.group = group
}
}
/// inherit from Role
class User: Role {
}
- Parameters,Returns,Throws
/**
The sum of two numbers:
- Parameters:
- num1: the first number
- num2: the sceond number
- Returns: The sum of num1 and num2
- Throws: num1 or num2 is nil
*/
func sum(num1: Int,num2: Int) -> Int {
return num1 + num2
}
- 更多文档注释关键字
/// - Precondition: The object must contain all the information in the world.
/// - Postcondition: After the algorithm, the object will contain all the information in the universe.
/// - Requires: All the information in the object should be sorted.
/// - Invariant: The object will maintain sorted.
/// - Complexity: O(n^n)
/// - Important: Please only call this algorithm once in your program.
/// - Warning: Very computation consuming.
/// - Attention: Same as Warning.
/// - Note: I terribly doubt this algorihtm.
/// - Remark: Same as Note.
/// - Author: liuyubobobo
/// - Authors: All the geeks in the world:)
/// - Copyright: liuyubobobo@2016
/// - Date: 26 Jan, 2016
/// - Since: iOS 5
/// - Version: 3.1415926
- MARK, TODO和FIXME
// TODO: Offer a all parameters initializer
// MARK: Methods
// FIXME: Support Swift 2.2
网友评论