声明
func swiftBlock(endStr: String, _ callBack: (_ result: String) -> ()) {
let str: String = "test" + endStr
callBack(str)
}
调用:
swiftBlock(end: "lalalla") { (_ str) in
print("str === \(str)")
}
声明
func swiftBlock(endStr: String, _ callBack: (_ result: String) -> ()) {
let str: String = "test" + endStr
callBack(str)
}
调用:
swiftBlock(end: "lalalla") { (_ str) in
print("str === \(str)")
}
本文标题:Swift 中闭包的使用
本文链接:https://www.haomeiwen.com/subject/pdepuftx.html
网友评论