Swift方法声明可选参数

2017/08/15 posted in  iOS

声明

str2:String? = nil

如:

func test(str:String, str2:String? = nil){
}
test("哈哈");
test("哈哈", str2: "哈哈哈");